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

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

Thread Previous | Thread Next
From:
H . Merijn Brand
Date:
June 27, 2001 07:01
Subject:
Re: Report /pro/3gl/CPAN/perl-5.7.1
Message ID:
20010627153651.724C.H.M.BRAND@hccnet.nl
On Wed 27 Jun 2001 00:01, Nicholas Clark <nick@ccl4.org> 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.
> 
> What are the values of HAS_MODFL and HAS_MODFL_POW32_BUG on the unhappy
> platform (AIX, isn't it?)

1. HP has modf () instead of modfl ()
2. HP does not support long doubles
3. HP does not support %.64Lg
4. AIX cores with native compiler

Script started on Wed Jun 27 15:21:15 2001
]0;merijn@l1:/tmp [2556:ttyq5]l1:/tmp 101 > cat modfl.c
#include <stdio.h>

#ifdef __hpux
# include <math.h>
  typedef double ldouble;
#else
  typedef long double ldouble;
# endif

int main (int argc, char *argv)
{
    ldouble a = 279964589018079.;
    ldouble y = 4745162525730.;
    ldouble x;

    x = a / 59.;
#ifdef __hpux
    printf ("This is on HP-UX\n");
    (void)modf (x, &x);
#else
    (void)modfl (x, &x);
# endif

    printf ("The modf passed\n");
#ifdef __hpux
    printf ("x = %.64g\n", x);
    printf ("y = %.64g\n", y);
#else
    printf ("x = %.64Lg\n", x);
    printf ("y = %.64Lg\n", y);
# endif
    if (x == y)
	puts ("x == y");
    else
	puts ("x != y");
  
    return (0);
    } /* main */
l1:/tmp 102 > cc -o modfl modfl.c -lm
/usr/ccs/bin/ld: (Warning) At least one PA 2.0 object file (modfl.o) was detected. The linked output may not run on a PA 1.x system.
l1:/tmp 103 > ./modfl
This is on HP-UX
The modf passed
x = 4745162525730
y = 4745162525730
x == y
l1:/tmp 104 > cc +DD64 -o modfl modfl.c -lm
l1:/tmp 105 > ./modfl
This is on HP-UX
The modf passed
x = 4745162525730
y = 4745162525730
x == y
l1:/tmp 106 > gcc-2.95.3 -o modfl modfl.c -lm
as: "/tmp/ccodigvJ.s", line 67: warning 36: Use of %fr22 is incorrect for the current LEVEL of 1.0
as: "/tmp/ccodigvJ.s", line 68: warning 36: Use of %fr22 is incorrect for the current LEVEL of 1.0
as: "/tmp/ccodigvJ.s", line 71: warning 36: Use of %fr22 is incorrect for the current LEVEL of 1.0
as: "/tmp/ccodigvJ.s", line 73: warning 36: Use of %fr22 is incorrect for the current LEVEL of 1.0
as: "/tmp/ccodigvJ.s", line 75: warning 36: Use of %fr22 is incorrect for the current LEVEL of 1.0
as: "/tmp/ccodigvJ.s", line 78: warning 36: Use of %fr23 is incorrect for the current LEVEL of 1.0
as: "/tmp/ccodigvJ.s", line 79: warning 36: Use of %fr22 is incorrect for the current LEVEL of 1.0
as: "/tmp/ccodigvJ.s", line 79: warning 36: Use of %fr23 is incorrect for the current LEVEL of 1.0
as: "/tmp/ccodigvJ.s", line 79: warning 36: Use of %fr22 is incorrect for the current LEVEL of 1.0
as: "/tmp/ccodigvJ.s", line 80: warning 36: Use of %fr22 is incorrect for the current LEVEL of 1.0
as: "/tmp/ccodigvJ.s", line 113: warning 36: Use of %fr22 is incorrect for the current LEVEL of 1.0
as: "/tmp/ccodigvJ.s", line 115: warning 36: Use of %fr23 is incorrect for the current LEVEL of 1.0
as: "/tmp/ccodigvJ.s", line 116: warning 36: Use of %fr22 is incorrect for the current LEVEL of 1.0
as: "/tmp/ccodigvJ.s", line 116: warning 36: Use of %fr23 is incorrect for the current LEVEL of 1.0
/usr/bin/ld: (Warning) At least one PA 2.0 object file (/pro/local/lib/gcc-lib/hppa2.0w-hp-hpux11.00/2.95.3/libgcc.a(__main.o)) was detected. The linked output may not run on a PA 1.x system.
l1:/tmp 107 > ./modfl
This is on HP-UX
The modf passed
x = 4745162525730
y = 4745162525730
x == y
l1:/tmp 108 > gcc-3.0 -o modfl modfl.c -lm
l1:/tmp 109 > ./modfl
This is on HP-UX
The modf passed
x = 4745162525730
y = 4745162525730
x == y
l1:/tmp 110 > /wrk/GNUpro/bin/gcc -o modfl modfl.c -lm
l1:/tmp 111 > ./modfl
This is on HP-UX
The modf passed
x = 4745162525730
y = 4745162525730
x == y
l1:/tmp 112 >

i2:/l1/tmp 105 > gcc -o modfl modfl.c -lm
i2:/l1/tmp 106 > ./modfl
The modf passed
x = 4745162525730.1523
y = 4745162525730
x != y
i2:/l1/tmp 107 > xlc -o modfl modfl.c -lm
i2:/l1/tmp 108 > ./modfl
Segmentation fault (core dumped)
i2:/l1/tmp 109 > xlc -o modfl modfl.c -lm
i2:/l1/tmp 110 > ./modfl
Segmentation fault (core dumped)
i2:/l1/tmp 111 >

=====================
now removed the '.' from all constants

l1:/tmp 178 > cc -o modfl modfl.c -lm
cc: "modfl.c", line 12: warning 602: Integer constant exceeds its storage.
cc: "modfl.c", line 13: warning 602: Integer constant exceeds its storage.
/usr/ccs/bin/ld: (Warning) At least one PA 2.0 object file (modfl.o) was detected. The linked output may not run on a PA 1.x system.
l1:/tmp 179 > modfl
This is on HP-UX
The modf passed
x = 24420264
y = 3518630946
x != y
l1:/tmp 180 > cc +DD64 -o modfl modfl.c -lm
l1:/tmp 181 > modfl
This is on HP-UX
The modf passed
x = 4745162525730
y = 4745162525730
x == y
l1:/tmp 182 > gcc-3.0 -o modfl modfl.c -lm
l1:/tmp 183 > modfl
This is on HP-UX
The modf passed
x = 4745162525730
y = 4745162525730
x == y
l1:/tmp 184 > /wrk/GNUpro/bin/gcc -o modfl modfl.c -lm
l1:/tmp 185 > modfl
This is on HP-UX
The modf passed
x = 4745162525730
y = 4745162525730
x == y
l1:/tmp 186 > gcc-3.0 -mpa-risc-1-1 -o modfl modfl.c -lm
l1:/tmp 187 > modfl
This is on HP-UX
The modf passed
x = 4745162525730
y = 4745162525730
x == y
l1:/tmp 188 >


i2:/l1/tmp 113 > xlc -o modfl modfl.c -lm
"modfl.c", line 12.17: 1506-207 (W) Integer constant 279964589018079 out of range.
"modfl.c", line 13.17: 1506-207 (W) Integer constant 4745162525730 out of range.
i2:/l1/tmp 114 > gcc -o modfl modfl.c -lm
i2:/l1/tmp 115 > ./modfl
The modf passed
x = 4745162525730.1523
y = 4745162525730
x != y
i2:/l1/tmp 116 >

-- 
H.Merijn Brand    Amsterdam Perl Mongers (http://www.amsterdam.pm.org/)
using perl-5.6.1, 5.7.1 & 626 on HP-UX 10.20 & 11.00, AIX 4.2, AIX 4.3,
     WinNT 4, Win2K pro & WinCE 2.11 often with Tk800.022 &/| DBD-Unify
ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/


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