Description
NaN values generated by perl, such as the result of a string-to-number conversion or the returned value of POSIX::NAN
, are actually -NaN (i.e. its sign bit is inverted).
As -NaN is also NaN, this seems not to be a serious issue, but inconsistent with underlying C library/compilers.
Steps to Reproduce
$ perl -wle 'print unpack "H*", pack "F>", 0 + "NaN"'
fff8000000000000
$ perl -MPOSIX -wle 'print "NAN is negative" if POSIX::signbit(POSIX::NAN())'
NAN is negative
Expected behavior
perl should generate NaNs with their sign bits cleared.
Perl configuration
$ perl -V
Summary of my perl5 (revision 5 version 33 subversion 6) configuration:
Commit id: a55134cc382529aee24f81156d7540b61a753544
Platform:
osname=linux
osvers=4.19.0-13-686-pae
archname=i686-linux
uname='linux x41 4.19.0-13-686-pae #1 smp debian 4.19.160-2 (2020-11-28) i686 gnulinux '
config_args='-de -Dusedevel -DEBUGGING'
hint=recommended
useposix=true
d_sigaction=define
useithreads=undef
usemultiplicity=undef
use64bitint=undef
use64bitall=undef
uselongdouble=undef
usemymalloc=n
default_inc_excludes_dot=define
Compiler:
cc='cc'
ccflags ='-fwrapv -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2'
optimize='-O2 -g'
cppflags='-fwrapv -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
ccversion=''
gccversion='8.3.0'
gccosandvers=''
intsize=4
longsize=4
ptrsize=4
doublesize=8
byteorder=1234
doublekind=3
d_longlong=define
longlongsize=8
d_longdbl=define
longdblsize=12
longdblkind=3
ivtype='long'
ivsize=4
nvtype='double'
nvsize=8
Off_t='off_t'
lseeksize=8
alignbytes=4
prototype=define
Linker and Libraries:
ld='cc'
ldflags =' -fstack-protector-strong -L/usr/local/lib'
libpth=/usr/local/lib /usr/lib/gcc/i686-linux-gnu/8/include-fixed /usr/include/i386-linux-gnu /usr/lib /lib/i386-linux-gnu /lib/../lib /usr/lib/i386-linux-gnu /usr/lib/../lib /lib /lib64 /usr/lib64
libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
libc=libc-2.28.so
so=so
useshrplib=false
libperl=libperl.a
gnulibc_version='2.28'
Dynamic Linking:
dlsrc=dl_dlopen.xs
dlext=so
d_dlsymun=undef
ccdlflags='-Wl,-E'
cccdlflags='-fPIC'
lddlflags='-shared -O2 -g -L/usr/local/lib -fstack-protector-strong'
Characteristics of this binary (from libperl):
Compile-time options:
DEBUGGING
HAS_TIMES
PERLIO_LAYERS
PERL_COPY_ON_WRITE
PERL_DONT_CREATE_GVSV
PERL_MALLOC_WRAP
PERL_OP_PARENT
PERL_PRESERVE_IVUV
PERL_USE_DEVEL
USE_LARGE_FILES
USE_LOCALE
USE_LOCALE_COLLATE
USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC
USE_LOCALE_TIME
USE_PERLIO
USE_PERL_ATOF
Built under linux
Compiled at Jan 14 2021 01:29:14
@INC:
lib
/usr/local/lib/perl5/site_perl/5.33.6/i686-linux
/usr/local/lib/perl5/site_perl/5.33.6
/usr/local/lib/perl5/5.33.6/i686-linux
/usr/local/lib/perl5/5.33.6
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4