mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[poincare] ApproximationHelper: fix precision threshold of
NeglectRealOrImaginaryPartIfNeglectable
This commit is contained in:
committed by
LeaNumworks
parent
d431642e60
commit
879c1e3bf1
@@ -11,7 +11,7 @@ extern "C" {
|
||||
namespace Poincare {
|
||||
|
||||
template <typename T> bool isNegligeable(T x, T precision, T norm1, T norm2) {
|
||||
return x <= precision && x/norm1 <= precision && x/norm2 <= precision;
|
||||
return x <= 10.0*precision && x/norm1 <= precision && x/norm2 <= precision;
|
||||
}
|
||||
|
||||
template < typename T> T minimalNonNullMagnitudeOfParts(std::complex<T> c) {
|
||||
@@ -47,7 +47,7 @@ template <typename T> std::complex<T> ApproximationHelper::NeglectRealOrImaginar
|
||||
* small as 1E-308 (in double) and most results still be correct. */
|
||||
T magnitude1 = minimalNonNullMagnitudeOfParts(input1);
|
||||
T magnitude2 = minimalNonNullMagnitudeOfParts(input2);
|
||||
T precision = 100.0*Expression::Epsilon<T>();
|
||||
T precision = 10.0*Expression::Epsilon<T>();
|
||||
if (isNegligeable(std::fabs(result.imag()), precision, magnitude1, magnitude2)) {
|
||||
result.imag(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user