|XP is just a number|
Portability of floor(log(N))by toolic (Bishop)
|on Mar 12, 2018 at 16:48 UTC||Need Help??|
toolic has asked for the wisdom of the Perl Monks concerning the following question:
I uploaded the latest version of Number::FormatEng (0.03) to CPAN four months ago, and all tests passed until last week. I am trying to understand why a test failed.
Only one test fails, and it happens on only one os/archname (OpenBSD.amd64-openbsd-thread-multi-ld) and on these two versions of Perl: 5.24.3 and 5.26.1. There are many passes (606) across all OS's.
The failing test is:
This is when the test calls format_pref(1e-33). 1000e-36 is the same numeric value as 1e-33, but the point of this function is to display the number with a specific format.
I can't reproduce this because I don't have this OS or Perl version. But, from the tester report, I assume it fails on this line in FormatEng.pm:
where floor is from POSIX.
When the test passes, $num=1e-33, and $e is -11. When the test fails, I assume $e is -12. Perhaps log(1e-33)/log(1000) evaluates to -11.0001, or -11.1, or -11.2, etc.
Is it possible for me to fix the code to make it more portable? Or, is there a known problem with this OS for these Perl versions?