Mantis - Squeak
Viewing Issue Advanced Details
7555 Kernel minor always 08-21-10 20:38 02-06-11 23:48
nicolas cellier  
nicolas cellier  
normal  
closed trunk  
fixed  
none    
none trunk  
0007555: Float negativeZero abs sign negative
I expect the sign of the absolute value to always be positive...

In other words,
    -0.0 abs -> 0.0 rather than -0.0

In other words,
    self deny: Float negativeZero abs sign negative
I checked fabs in C in i386:

#include <math.h>
#include <stdio.h>
int main(void)
{
    double nz,snz,anz;
    nz=1.0e-300 * -1.0e-300;
    snz=sqrt(nz);
    anz=fabs(nz);
    printf("sqrt(%f)=%f\n",nz,snz);
    printf("fabs(%f)=%f\n",nz,anz);
    return 0;
}

sqrt(-0.000000)=-0.000000
fabs(-0.000000)=0.000000

I'm amazed of sqrt result, and that can explain squeak behaves the same.
But at least, we should fix squeak abs.

Notes
(0013840)
nicolas cellier   
08-21-10 20:45   
Fixed in:
http://source.squeak.org/trunk/Kernel-nice.479.mcz [^]
http://source.squeak.org/trunk/KernelTests-nice.157.mcz [^]