[BUG] Json Number equality ignores preserved textual repr
Describe the bug When parsing large or out‑of‑range JSON numbers, the parser stores them as Json::Number(double, repr=Some(original_string)) where the double field is set to +/- Infinity and the original literal is kept in repr. The current Eq implementation compares only the double value when repr is present, causing different large numeric literals (e.g. 9007199254740992 vs 9007199254740993) to be considered equal. It is unclear whether this is by design or an unintended bug.
To Reproduce let a = @json.parse("9007199254740992") let b = @json.parse("9007199254740993") a == b
Expected behavior false
This is the intended behavior. Otherwise we would have to compare 10 10.0 10.00 10.0000 1e1, etc, which is not very practical.
This is the intended behavior. Otherwise we would have to compare
1010.010.0010.00001e1, etc, which is not very practical.
Can we add a check while maintaining the current comparison logic: only compare repr values for equality when the double field is Infinity?
It might make sense if we are Json is used as a sort of serialization format? cc @bobzhang