Subj : Re: Proper behavior of uneval(-0.0) ? To : Igor Bukanov From : Brendan Eich Date : Wed Nov 12 2003 11:16 am This is a multi-part message in MIME format. --------------090901060003020003090508 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Igor Bukanov wrote: > > Currently in SM uneval(-0.0) gives "0". Should it be "-0.0" instead? I don't think so, based on ECMA-262 Edition 3 9.8.1 step 2. On the other hand, uneval is an extension. We could make it have a special case here. I'm hesitant to do that, on general KISS grounds. Is there a compelling use-case? -0 is handy for things like Math.atan2: js> Math.atan2(0,0) 0 js> Math.atan2(0,-0) 3.141592653589793 js> Math.atan2(-0,-0) -3.141592653589793 js> Math.atan2(-0,0) 0 /be --------------090901060003020003090508 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit Igor Bukanov wrote:

Currently in SM uneval(-0.0) gives "0". Should it be "-0.0" instead?

I don't think so, based on ECMA-262 Edition 3 9.8.1 step 2.  On the other hand, uneval is an extension.  We could make it have a special case here.  I'm hesitant to do that, on general KISS grounds.  Is there a compelling use-case?

-0 is handy for things like Math.atan2:

js> Math.atan2(0,0)
0
js> Math.atan2(0,-0)
3.141592653589793
js> Math.atan2(-0,-0)
-3.141592653589793
js> Math.atan2(-0,0)
0

/be
--------------090901060003020003090508-- .