mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-20 01:08:15 +01:00
[poincare/function] f(1/0) = undef when f(x) = 3
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
#include <poincare/parenthesis.h>
|
||||
#include <poincare/rational.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
|
||||
#include <poincare/symbol.h>
|
||||
#include <poincare/undefined.h>
|
||||
#include <cmath>
|
||||
@@ -80,6 +79,10 @@ Evaluation<double> FunctionNode::approximate(DoublePrecision p, Context * contex
|
||||
|
||||
template<typename T>
|
||||
Evaluation<T> FunctionNode::templatedApproximate(Context * context, Preferences::ComplexFormat complexFormat, Preferences::AngleUnit angleUnit) const {
|
||||
if (childAtIndex(0)->approximate((T)1, context, complexFormat, angleUnit).isUndefined()) {
|
||||
return Complex<T>::Undefined();
|
||||
}
|
||||
|
||||
Function f(this);
|
||||
Expression e = SymbolAbstract::Expand(f, context, true);
|
||||
if (e.isUninitialized()) {
|
||||
@@ -112,6 +115,9 @@ Expression Function::replaceSymbolWithExpression(const SymbolAbstract & symbol,
|
||||
}
|
||||
|
||||
Expression Function::shallowReduce(ExpressionNode::ReductionContext reductionContext) {
|
||||
if (childAtIndex(0).isUndefined()) {
|
||||
return replaceWithUndefinedInPlace();
|
||||
}
|
||||
Expression result = SymbolAbstract::Expand(*this, reductionContext.context(), true);
|
||||
if (result.isUninitialized()) {
|
||||
if (reductionContext.symbolicComputation()) {
|
||||
|
||||
Reference in New Issue
Block a user