Bug 134920 - JSON.parse gives incorrect result for "-0 ".
Summary: JSON.parse gives incorrect result for "-0 ".
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 420+
Hardware: Unspecified OS X 10.7
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-15 00:09 PDT by Lasse R.H. Nielsen
Modified: 2019-09-24 17:30 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lasse R.H. Nielsen 2014-07-15 00:09:31 PDT
JSON.parse("-0 ") should give the same result as JSON.parse("-0"), but where the latter correctly returns -0.0, the former returns positive 0.0.
Comment 1 Alexey Shvayka 2019-06-10 17:53:33 PDT
This is fixed as of rev. 246299: negative zero surrounded by whitespace is parsed correctly.
To prevent regressions, I am adding a few test cases to Test262: https://github.com/tc39/test262/pull/2196 (file: text-negative-zero.js)