in reply to Re^2: Negative zero from a multiplication by a zero?
in thread Negative zero from a multiplication by a zero?

I've reproduced it on two (out of two) linux boxes, one a 64bit machine.
$ perl -e 'for (-2.0,-1.9,-1.5,-1.1,-1.0,-0.9,-0.5,-0.1,-0) {$v = $_ * 0; printf("%5s -> %2s,%.100e\n",$_,$v,$v)}' -2 -> 0,0.00000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000e+00 -1.9 -> -0,-0.0000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000e+00 -1.5 -> -0,-0.0000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000e+00 -1.1 -> -0,-0.0000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000e+00 -1 -> 0,0.00000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000e+00 -0.9 -> -0,-0.0000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000e+00 -0.5 -> -0,-0.0000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000e+00 -0.1 -> -0,-0.0000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000e+00 0 -> 0,0.00000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000e+00 $ perl -v This is perl, v5.8.8 built for i486-linux-gnu-thread-multi ... $ uname -a Linux fmdev10 2.6.24-etchnhalf.1-686 #1 SMP Tue Dec 2 07:56:33 UTC 200 +8 i686 GNU/Linux

(Debian build)

Replies are listed 'Best First'.
Re^4: Negative zero from a multiplication by a zero?
by Marshall (Canon) on Jun 09, 2009 at 18:13 UTC
    I don't know what to say about this. It is weird to be sure! I have a 32 bit MS box.

    C:\TEMP>perl -v This is perl, v5.10.0 built for MSWin32-x86-multi-thread (with 5 registered patches, see perl -V for more detail)
    Update: did a uname -a
    C:\TEMP>uname -a CYGWIN_NT-5.1 cobra 1.5.25(0.156/4/2) 2008-06-12 19:34 i686 Cygwin
      Again, not all machines and libraries support negative zeroes. Perl lets the underlying layers handle this, so the results won't be the same on all machines.