develooper Front page | perl.perl5.porters | Postings from July 2005

[perl #36654] Inconsistent treatment of NaN

From:
Sisyphus
Date:
July 26, 2005 00:53
Subject:
[perl #36654] Inconsistent treatment of NaN
Message ID:
rt-3.0.11-36654-118284.8.32256701591398@perl.org
# New Ticket Created by  "Sisyphus" 
# Please include the string:  [perl #36654]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=36654 >


This is a bug report for perl from sisyphus1@optusnet.com.au ,
generated with the help of perlbug 1.35 running under perl v5.8.7.


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

use warnings;

my $z = NaN;

$z += 1;

print $z, "\n";

__END__

When I run that I get an output of simply:
1

NaN + 1 should be NaN, not 1. If NaN is treated as a string, then
you would expect a value of 1 - but if NaN were being treated as
a string there would have been a warning that "NaN" is not numeric -
and no such warning appears. One is left to conclude that NaN is
understood, but not handled correctly. Inf is similarly mishandled.

Same problem on both Linux and Win32.

There has been some discussion about this on the c.l.p.misc thread
called "IEEE NaN screwed up?" and the p5p thread "NaN on platforms
that don't support it".

Seems that the perlop, perlfunc, and perldata docs are also in need
of change wrt what they say about NaN.

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=low
---
Site configuration information for perl v5.8.7:

Configured by Rob at Wed Jun  8 18:44:11 2005.

Summary of my perl5 (revision 5 version 8 subversion 7) configuration:
  Platform:
    osname=MSWin32, osvers=5.0, archname=MSWin32-x86-multi-thread
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    usethreads=define use5005threads=undef useithreads=define
usemultiplicity=define
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='gcc', ccflags
='-s -O2 -DWIN32 -DHAVE_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_S
YS -fno-strict-aliasing -DPERL_MSVCRT_READFIX',
    optimize='-s -O2',
    cppflags='-DWIN32'
    ccversion='', gccversion='3.4.4', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='long long',
lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='g++', ldflags ='-s -L"D:\perl58_M\5.8.7\lib\CORE" -L"D:\MinGW\lib"'
    libpth=D:\MinGW\lib




libs= -lmsvcrt -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 
-ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lw
inmm -lversion -lodbc32




perllibs= -lmsvcrt -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdl
g32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr
 -lwinmm -lversion -lodbc32
    libc=-lmsvcrt, so=dll, useshrplib=yes, libperl=libperl58.a
    gnulibc_version='undef'
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ',
lddlflags='-mdll -s -L"D:\perl58_M\5.8.7\lib\CORE" -L"D:\MinGW\lib"'

Locally applied patches:


---
@INC for perl v5.8.7:
    D:/perl58_M/5.8.7/lib
    D:/perl58_M/site/5.8.7/lib
    D:/perl58_M/site/lib
    .

---
Environment for perl v5.8.7:
    HOME (unset)
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)

PATH=D:\dmake;F:\vsnet\vc7\bin;D:\perl58_M\5.8.7\bin;D:\MinGW\bin;D:\gzip\bi
n;D:\gettext;D:\tar;D:\zip;D:\diffutils\bin;D:\bzip2\bin;D:\pgplot\bin;D:\ba
tch;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;D:\third_party_dll;E:\
GTK\bin;;F:\WinCvs\CVSNT
    PERL_BADLANG (unset)
    SHELL (unset)






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