Closed 9il closed 1 year ago
Unless you give me an example of what happens now and what should happen instead, I don't know how I can fix this.
It would be much more helpfull to print floating points in assert messages of should and shouldApproxEqual in sciencific notation with 16 decimal points after the dot using C library. Phobos gives wrong results (if it doesn't use C library for sciencific notation, I am not sure about if it is). Ofcourse, you are wellcome to use Mir's to!string, it will give the full precision in minimal form. C's sciencific notation is good too.
Unitthreaded example:
unittest
{
import unit_threaded;
auto a = 1e-7;
a.shouldApproxEqual(0, 1e-8, 1e-8);
}
unit_threaded.exception.UnitTestException@source/mir/complex/math.d(376): Expected approx: 0
Got : 0.000000
The same example with mir.test
unittest
{
import mir.test;
auto a = 1e-7;
a.shouldApprox(1e-8, 1e-8) == 0;
}
mir.exception.MirError@source/mir/date.d(4473): expected approximately 0.0, got 1e-7, maxRelDiff = 1e-8, maxAbsDiff = 1e-8
It is essential to see the whole number when debugging numeric algorithms.