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

[ID 20010123.040] calculation error

Thread Next
From:
wdsource
Date:
January 23, 2001 17:01
Subject:
[ID 20010123.040] calculation error
Message ID:
200101240100.RAA01179@billy.xao.com

This is a bug report for perl from am@amsoft.ru,
generated with the help of perlbug 1.28 running under perl v5.6.0.


-----------------------------------------------------------------
[Please enter your report here]

Hi!

It looks very weird to me that int(1028.09*100) is not 102809 in perl 5.6.0
Try this simple script:

for(my $i=1; $i!=100000; $i++) {
   my $a=$i+0.09;
   my $b=int($a*100);
   my $c=$i*100+9;
   printf "%10u <> %10u ERROR!\n",$b,$c unless $b==$c;
}

Here is a head of output:

     25608 <>      25609 ERROR!
     25708 <>      25709 ERROR!
[..]
     32708 <>      32709 ERROR!
    102408 <>     102409 ERROR!
    102508 <>     102509 ERROR!
[..]
    131008 <>     131009 ERROR!
   3276808 <>    3276809 ERROR!
[..]



[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=medium
---
This perlbug was built using Perl v5.6.0 - Mon Aug  7 20:38:59 CEST 2000
It is being executed now by  Perl v5.6.0 - Thu Jul 27 12:56:15 PDT 2000.

Site configuration information for perl v5.6.0:

Configured by am at Thu Jul 27 12:56:15 PDT 2000.

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
    osname=linux, osvers=2.2.12-29.4smp, archname=i686-linux
    uname='linux billy 2.2.12-29.4smp #1 smp tue oct 26 13:25:32 pdt 1999 i686 unknown '
    config_args=''
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=define 
    use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
  Compiler:
    cc='cc', optimize='-O2', gccversion=egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
    cppflags='-fno-strict-aliasing'
    ccflags ='-fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
    stdchar='char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lndbm -ldb -ldl -lm -lc -lposix -lcrypt
    libc=/lib/libc-2.1.1.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
    

---
@INC for perl v5.6.0:
    /usr/lib/perl5/5.6.0/i386-linux
    /usr/lib/perl5/5.6.0
    /usr/lib/perl5/site_perl/5.6.0/i386-linux
    /usr/lib/perl5/site_perl/5.6.0
    /usr/lib/perl5/site_perl/5.005/i386-linux
    /usr/lib/perl5/site_perl/5.005
    /usr/lib/perl5/site_perl
    .

---
Environment for perl v5.6.0:
    HOME=/home/wdsource
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/bin:/usr/bin:/usr/local/bin:/usr/bin/X11:/usr/X11R6/bin:/home/wdsource/bin
    PERL_BADLANG (unset)
    SHELL=/bin/bash


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