From: | gregoa [...] cpan.org |
Subject: | libdatetime-perl: FTBFS on powerpcspe because floating point is too precise |
This bug has been forwarded from http://bugs.debian.org/729672
-->-->-->-->-->-->-->-->-->-->-->-->-->-->-->-->-->-->-->-->
Package: libdatetime-perl
Version: 1.03-1
Severity: wishlist
Tags: patch sid
User: debian-powerpcspe@breakpoint.cc
Usertags: powerpcspe
Hi,
libdatetime-perl FTBFS on powerpcspe[1] like this:
===============================================================
dh_auto_test -a
t/00load.t ....................... ok
t/01sanity.t ..................... ok
t/02last-day.t ................... ok
t/03components.t ................. ok
t/04epoch.t ...................... ok
t/05set.t ........................ ok
t/06add.t ........................ ok
t/07compare.t .................... ok
t/09greg.t ....................... ok
t/10subtract.t ................... ok
t/11duration.t ................... ok
t/12week.t ....................... ok
t/13strftime.t ................... ok
t/14locale.t ..................... ok
t/15jd.t ......................... ok
t/16truncate.t ................... ok
t/17set-return.t ................. ok
t/18today.t ...................... ok
t/19leap-second.t ................ ok
# Failed test 'positive infinity is really positive'
# at t/20infinite.t line 31.
# Failed test 'infinity - normal = infinity'
# at t/20infinite.t line 42.
# Failed test 'normal - infinity = neg infinity'
# at t/20infinite.t line 54.
[...]
===============================================================
Turns out that libdatetime-perl defines infinity like this:
use constant INFINITY => ( 9**9**9 );
On other platforms, this results in overflow, thus infinity:
$ perl -e 'print 9**9**9 . "\n";'
inf
On powerpcspe:
$ perl -e 'print 9**9**9 . "\n";'
1.79769313486232e+308
However, 9**9**9**9 is infinite, even on powerpcspe:
$ perl -e 'print 9**9**9**9 . "\n";'
inf
Alternatively, you could also do like this:
perl -e 'print 0+'inf' . "\n";'
inf
perl -e 'print 0+'-inf' . "\n";'
-inf
I'm using the first approach in the attached patch.
Roland
/*
Patch at
http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=5;filename=fix-powerpcspe.patch;att=1;bug=729672
*/
<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--
Thanks in advance,
gregor herrmann, Debian Perl Group