develooper Front page | perl.perl5.porters | Postings from June 2001

Re: Report /pro/3gl/CPAN/perl-5.7.1

Thread Previous | Thread Next
From:
Jarkko Hietaniemi
Date:
June 26, 2001 15:45
Subject:
Re: Report /pro/3gl/CPAN/perl-5.7.1
Message ID:
20010626174506.T21832@chaos.wustl.edu
On Tue, Jun 26, 2001 at 11:01:42PM +0100, Nicholas Clark wrote:
> On Mon, Jun 25, 2001 at 05:27:44PM -0500, Jarkko Hietaniemi wrote:
> 
> > 
> > tcsh ibmsp01e:/tmp/jhi/perl/t ; ./perl -I../lib x
> > not ok 13 # int(279964589018079/59) is 4745162525730, not 4745162525730
> > SV = PVNV(0x2005c5d8) at 0x20041f84
> 
> >   NV = 4745162525730
> >   NV = 4745162525730
> 
> This is crazy. They appear to be the same.
> What does C think? I believe that the translation is
> 
> ________________________________________________________________
> #include <stdio.h>
> 
> int main (void) {
>   long double a = 279964589018079;
>   long double y = 4745162525730;
>   long double x;
> 
>   x = a / 59;
>   (void) modfl(x, &x);
> 
>   printf ("x=%.64Lg\n", x);
>   printf ("y=%.64Lg\n", y);
>   if (x == y)
>     puts ("x==y");
>   else
>     puts ("x!=y");
>   
>   return 0;
> }
> ________________________________________________________________
> 
> which on all the platforms I can test on (ARMLinux, where sizeof(long
> double) == sizeof(double) and x86 FreeBSD, where I had to s/modfl/modf/)
> I got == on both.

x=4745162525730
y=4745162525730
x==y

though I had to add the LL suffix to the constant or face the warnings
"x.c", line 4.19: 1506-207 (W) Integer constant 279964589018079 out of range.
"x.c", line 5.19: 1506-207 (W) Integer constant 4745162525730 out of range.

I also have to compile with -qlongdouble or face a segmentation fault
(but that's okay since that's the whole point of the exercise,
the original failure happened only with -Duselongdouble).
I can add -qlonglong, too, but that has no visible effect in any direction.
 
> What are the values of HAS_MODFL and HAS_MODFL_POW32_BUG on the unhappy
> platform (AIX, isn't it?)

Yes, AIX, 4.3.10.

d_modfl='undef'
d_modfl_pow32_bug='undef'

The modfl bug testing program

#include <math.h> 
#include <stdio.h>
int main() {
    long double nv = 4294967303.15;
    long double v, w;
    v = modfl(nv, &w);         
    printf(" %Lf %Lf %Lf\n", nv, v, w);
    return 0;
}

outputs

 4294967303.150000 0.000000 0.150000

Again compiled with -qlongdouble or executiong will segfault.

modfl() seems to have no man page.

> Nicholas Clark

-- 
$jhi++; # http://www.iki.fi/jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen

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