toolic has asked for the wisdom of the Perl Monks concerning the following question:
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.# Failed test at t/format_pref.t line 54. # got: '1000e-36' # expected: '1e-33'
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.my $e = floor( log($num) / log(1000) );
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?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Portability of floor(log(N))
by pryrt (Abbot) on Mar 12, 2018 at 17:45 UTC | |
by syphilis (Archbishop) on Mar 13, 2018 at 00:47 UTC | |
by toolic (Bishop) on Mar 13, 2018 at 14:48 UTC | |
by toolic (Bishop) on Mar 13, 2018 at 14:46 UTC | |
by pryrt (Abbot) on Mar 13, 2018 at 15:57 UTC | |
by syphilis (Archbishop) on Mar 13, 2018 at 22:50 UTC | |
by syphilis (Archbishop) on Mar 14, 2018 at 02:42 UTC | |
by toolic (Bishop) on Mar 14, 2018 at 17:31 UTC | |
|