mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-19 05:40:38 +01:00
[poincare] Trigonometry::characteristicXRange use double precision
derivative (to avoid computational error as diff(sin(x+46^2,x,1)))
This commit is contained in:
committed by
LeaNumworks
parent
6befc1e146
commit
4b9e42d522
@@ -74,9 +74,9 @@ float Trigonometry::characteristicXRange(const Expression & e, Context * context
|
||||
/* To compute a, the slope of the expression child(0), we compute the
|
||||
* derivative of child(0) for any x value. */
|
||||
Poincare::Derivative derivative = Poincare::Derivative::Builder(e.childAtIndex(0).clone(), Symbol::Builder(x, 1), Float<float>::Builder(1.0f));
|
||||
float a = derivative.node()->approximate(float(), context, Preferences::ComplexFormat::Real, angleUnit).toScalar();
|
||||
float pi = PiInAngleUnit(angleUnit);
|
||||
return 2.0f*pi/std::fabs(a);
|
||||
double a = derivative.node()->approximate(double(), context, Preferences::ComplexFormat::Real, angleUnit).toScalar();
|
||||
double pi = PiInAngleUnit(angleUnit);
|
||||
return std::fabs(a) < Expression::Epsilon<double>() ? NAN : 2.0*pi/std::fabs(a);
|
||||
}
|
||||
|
||||
bool Trigonometry::isDirectTrigonometryFunction(const Expression & e) {
|
||||
|
||||
Reference in New Issue
Block a user