[Scilab-users] What can be done with a signed zero -0 ?

Pinçon Bruno bruno.pincon at univ-lorraine.fr
Fri Jun 29 08:50:49 CEST 2018


Le 29/06/2018 à 01:12, Samuel Gougeon a écrit :
> Dear co-users,
>
> I am somewhat rediscovering that Scilab allows to defined a signed zero:
>
> --> zm = -0
>  zm  =
>    0.
>
> --> 1/zm
>  ans  =
>   -Inf
>
> It looks not documented. I am wondering where is the best place to 
> document it (i mean, which existing page?), and even if it is 
> worthwhile to document it.
>
> Indeed, what can be done with it? Beside inverting it into -%inf, 
> other operations are rather disappointing:
>
> --> zm==0
>  ans  =
>   T
>
> --> zm<0
>  ans  =
>   F
>
> --> sign(zm)
>  ans  =
>    0.
>
> Any idea about applications?

     Hi, there is no surprise here, it is (or should be) the same for
    any language using floating-point arithmetic as all these behaviors
    follow the floating-point standard. But yes the signed zero (so
    2 zeros in floating-point arithmetic) is surprising. Maybe a
    dedicated help page could be a good idea...

   Bruno





More information about the users mailing list