Subj : Re: -x when x == 0 treated as a double ? To : Mike Shaver From : Brendan Eich Date : Wed Jan 26 2005 08:35 pm Mike Shaver wrote: > bubbfree@gmail.com wrote: > >> I have some unexpected behavior in SpiderMonkey (latest RC6). If I do >> this: >> >> var x = 0; >> myNativeFunction(-x); >> >> the jsval in argv[0] for my native handler is of type double. I would >> have expected int. > > > I think double is correct there. Spidermonkey will express a number > internally as an int jsval only if the transformation is exact. Since > there's no integer representation with jsvals for -0, IIRC, it will > always be a double. Quite right, but the myNativeFunction(-0) case should also get a double jsval, not an int jsval. /be .