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

classic Classic list List threaded Threaded
5 messages Options
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

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

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?

Cheers
Samuel

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Rafael Guerra Rafael Guerra
Reply | Threaded
Open this post in threaded view
|

Re: What can be done with a signed zero -0 ?

Samuel,

Regarding signed zero applications, check this page out:
https://www.advanpix.com/2016/04/28/branch-cuts-and-signed-zeros-in-matlab/

Regards,
Rafael

-----Original Message-----
From: users [mailto:[hidden email]] On Behalf Of Samuel Gougeon
Sent: Friday, June 29, 2018 1:13 AM
To: International users mailing list for Scilab. <[hidden email]>
Subject: [Scilab-users] What can be done with a signed zero -0 ?

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?

Cheers
Samuel

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: What can be done with a signed zero -0 ?

Le 29/06/2018 à 01:25, Rafael Guerra a écrit :
> Samuel,
>
> Regarding signed zero applications, check this page out:
> https://www.advanpix.com/2016/04/28/branch-cuts-and-signed-zeros-in-matlab/

Thanks.
And this one: https://en.wikipedia.org/wiki/Signed_zero

It would be possible to document it in the ieee() or number_properties
pages, or the zeros() one,
or the %inf one, or in a dedicated page, to report Scilab behaviors wrt
it for some particular functions...

Reports about Scilab functions that make a difference between -0 and 0
are welcome.

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: What can be done with a signed zero -0 ?

Le 29/06/2018 à 01:39, Samuel Gougeon a écrit :

> Le 29/06/2018 à 01:25, Rafael Guerra a écrit :
>> Samuel,
>>
>> Regarding signed zero applications, check this page out:
>> https://www.advanpix.com/2016/04/28/branch-cuts-and-signed-zeros-in-matlab/ 
>>
>
> Thanks.
> And this one: https://en.wikipedia.org/wiki/Signed_zero
>
> It would be possible to document it in the ieee() or number_properties
> pages, or the zeros() one,
> or the %inf one, or in a dedicated page, to report Scilab behaviors
> wrt it for some particular functions...
>
> Reports about Scilab functions that make a difference between -0 and 0
> are welcome.

We have at least atan():
-->atan(0,0)
  ans  =
     0.

-->atan(0,-0)
  ans  =
     3.1415927
Could be documented as example in the atan() page.

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Pinçon Bruno Pinçon Bruno
Reply | Threaded
Open this post in threaded view
|

Re: What can be done with a signed zero -0 ?

In reply to this post by Samuel GOUGEON
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


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users