Package: libdatetime-perl
Version: 1.03-1
Severity: wishlist
Tags: patch sid
User: debian-powerpc...@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

[1] https://wiki.debian.org/PowerPCSPEPort


-- System Information:
Debian Release: 7.0
  APT prefers unreleased
  APT policy: (500, 'unreleased'), (500, 'unstable')
Architecture: powerpcspe (ppc)

Kernel: Linux 3.9.0-dirty (SMP w/2 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
--- libdatetime-perl-1.03.orig/lib/DateTime.pm
+++ libdatetime-perl-1.03/lib/DateTime.pm
@@ -72,8 +72,8 @@ require DateTime::Infinite;
 
 use constant MAX_NANOSECONDS => 1_000_000_000;    # 1E9 = almost 32 bits
 
-use constant INFINITY     => ( 9**9**9 );
-use constant NEG_INFINITY => -1 * ( 9**9**9 );
+use constant INFINITY     => ( 9**9**9**9 );
+use constant NEG_INFINITY => -1 * ( 9**9**9**9 );
 use constant NAN          => INFINITY - INFINITY;
 
 use constant SECONDS_PER_DAY => 86400;

Reply via email to