Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normative: ToInteger normalizes `-0` to `+0` #1827

Open
wants to merge 1 commit into
base: master
from

Conversation

@ljharb
Copy link
Member

ljharb commented Jan 3, 2020

Fixes #1637.

This only has an observable impact on Atomics.store.

@ljharb ljharb requested review from syg, michaelficarra, anba and bakkot Jan 3, 2020
ljharb added a commit to ljharb/ecma262 that referenced this pull request Jan 3, 2020
Fixes tc39#1637.

This only has an observable impact on `Atomics.store`.
@ljharb ljharb force-pushed the ljharb:to-integer-neg-zero branch from 297247b to 7b67249 Jan 3, 2020
ljharb added a commit to ljharb/ecma262 that referenced this pull request Jan 6, 2020
Fixes tc39#1637.

This only has an observable impact on `Atomics.store`.
@ljharb ljharb force-pushed the ljharb:to-integer-neg-zero branch from 7b67249 to b4b2cfe Jan 6, 2020
spec.html Outdated
@@ -26273,7 +26273,7 @@ <h1>Function.prototype.bind ( _thisArg_, ..._args_ )</h1>
1. If Type(_targetLen_) is not Number, let _L_ be 0.
1. Else,
1. Set _targetLen_ to ! ToInteger(_targetLen_).
1. Let _L_ be the larger of 0 and the result of _targetLen_ minus the number of elements of _args_.
1. Let _L_ be the larger of *+0* and the result of _targetLen_ minus the number of elements of _args_.

This comment has been minimized.

Copy link
@syg

syg Jan 8, 2020

Contributor

I don't think this line needs to change. There's no need to distinguish +0 from 0 here.

This comment has been minimized.

Copy link
@ljharb

ljharb Jan 8, 2020

Author Member

I can certainly revert it; it's implicitly +0 already, but #1086 intends to explicitly sign as many zeroes as possible.

This comment has been minimized.

Copy link
@syg

syg Jan 8, 2020

Contributor

There's this sentence already in the spec:

The Number value 0, alternatively written 0𝔽, is defined as the double-precision floating point positive zero value. In certain contexts, it may also be written as +0 for clarity.

When I see +0, I'm personally primed to think this is a place where I also need to care about -0. If it doesn't matter, it'd be better editorially to not distinguish IMO.

This comment has been minimized.

Copy link
@ljharb

ljharb Jan 8, 2020

Author Member

It matters in the sense that the length of a bound function should never be -0.

Fixes #1637.

This only has an observable impact on `Atomics.store`.
@ljharb ljharb force-pushed the ljharb:to-integer-neg-zero branch from b4b2cfe to b65c65b Jan 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.