You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During Phobos PR #7173, all 32bit machines failed in a unittest for the complex power operator, while all 64bit machines did not. This might be due to a bug in complex ^^.
The following program will probably reproduce the error, but I had no opportunity to check this, because I did not succeed in installing dmd on my old 32bit machine. (Got segmentation fault, whenever I started dmd. I think, a library is missing. ldc2 complained about not finding gcc, although being installed and in $PATH. And gdc did not reproduce the error, but used an older version of phobos.)
void main()
{
import std.complex;
auto rec3a = 0.79 ^^ complex(6.8, 5.7);auto rec3b = complex(0.79, 0.0) ^^ complex(6.8, 5.7);assert(approxEqual(rec3a.re, rec3b.re, double.epsilon));
}
bool approxEqual(T, U, V)(T lhs, U rhs, V maxRelDiff = 1e-9, V maxAbsDiff = 0)
{
import std.traits:isIntegral;
import std.math:fabs;
if (isIntegral!T || isIntegral!U){ return approxEqual(real(lhs), real(rhs), maxRelDiff, maxAbsDiff);}if (lhs == rhs) return true;static if (is(typeof(lhs.infinity)) && is(typeof(rhs.infinity))){ if (lhs == lhs.infinity || rhs == rhs.infinity || lhs == -lhs.infinity || rhs == -rhs.infinity) return false;}auto diff = fabs(lhs - rhs);return diff <= maxRelDiff*fabs(lhs) || diff <= maxRelDiff*fabs(rhs) || diff <= maxAbsDiff;
}
The text was updated successfully, but these errors were encountered:
dlang reported this on 2019-09-12T08:15:07Z
Transfered from https://issues.dlang.org/show_bug.cgi?id=20206
Description
The text was updated successfully, but these errors were encountered: