archives

« Bugzilla Issues Index

#3582 — 7.1.* ToInt32, etc. : not clear what should be produced by -0.2


For To[U]Int{32, 16, 8} abstract operations, there is a similar issue to ToInteger (Bug 3581); but in those algorithms, the intended output is +0 rather than -0.

I suggest the following formulation, which make super-clear the intent around -0:

1. Let int be ToInteger(argument).
2. ReturnIfAbrupt(int).
3. If int is -0, let int be +0.
4. (proceed with current steps 5-6).

(The above does not apply to ToUInt8Clamp, which is fine.)


and also, unlike ToInteger, +/- infinity is not preserved.


fixed in rev32 editor's draft

I copied the new ToInteger langue into step 4 of each. I think they are easier to understand when everything except ToNumber is done in-line.


fixed in rev32 draft