develooper Front page | perl.perl5.porters | Postings from April 2013

Re: Blead on s390x

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
April 7, 2013 11:20
Subject:
Re: Blead on s390x
Message ID:
20130407112001.GK3729@plum.flirble.org
On Sun, Apr 07, 2013 at 10:27:55AM +0200, H.Merijn Brand wrote:
> On Sun, 7 Apr 2013 08:16:56 +0100, Nicholas Clark <nick@ccl4.org> wrote:

> > Yes, at the moment it looks like there's a portability problem with
> > something numeric. It's not clear if its a bug in our assumptions or their
> > implementation.
> 
> Or Hercules.

> > Hmm, which would be consistent with the errors below, if ~0+1 is incorrectly
> > becoming 9.2e+18

> test@zdolinux:/perl/perl-git> ./perl -Ilib -MDevel::Peek -we '$a = 18446744073709551615; $a = $a + 1; printf "%g\n", $a; Dump $a'
> 9.22337e+18
> SV = PVNV(0x8019a6c8) at 0x801b3498
>   REFCNT = 1
>   FLAGS = (NOK,pNOK)
>   IV = -1
>   NV = 9223372036854775808
>   PV = 0

Thanks. So, the special case code in pp_inc works just fine, but the
conversion inside sv_2nv_flags() seems to go wrong.


I wonder, what does this C program generate?

#include <stdio.h>

union u {
    long i;
    unsigned long u;
};

int main (int argc, char **argv) {
    union u var;
    double d;
    var.u = ~0;

    d = argc ? (double) var.u : (double) var.i;
    printf ("i = %ld, u = %lu, d = %g\n", var.i, var.u, d);
    return 0;
}


It's pretty close to the guts of sv_2nv_flags

On Sun, Apr 07, 2013 at 01:07:46PM +0200, H.Merijn Brand wrote:

> -Duselongdouble is much worse btw.
> 
> Files=2384, Tests=559691, 6955 wallclock secs (2134.38 usr 142.80 sys + 15334.04 cusr 1133.96 csys = 18745.18 CPU)
> Result: FAIL
> make: *** [test_harness] Error 84
> 
> t/base/num .................................................... FAILED at test 5
> Failed a basic test (base/num.t) -- cannot continue.

I'm not surprised. There seems to be something very wrong with conversions
from large integers to floating point.

Nicholas Clark

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About