fix: preserve numerical precision on unary negation (#3242)

This commit is contained in:
itchyny authored and GitHub committed 2025-02-06 07:50:21 +09:00
1 parent 972772153f
commit 6ce3bdf382
7 files changed
+55 -22

No files matched your search

+6 -2
View File
@@ -6,15 +6,19 @@
0.12345678901234567890123456789
0.12345678901234567890123456789
[., tojson] | . == if have_decnum then [12345678909876543212345,"12345678909876543212345"] else [12345678909876543000000,"12345678909876543000000"] end
[., tojson] == if have_decnum then [12345678909876543212345,"12345678909876543212345"] else [12345678909876543000000,"12345678909876543000000"] end
12345678909876543212345
true
[1234567890987654321,-1234567890987654321 | tojson] == if have_decnum then ["1234567890987654321","-1234567890987654321"] else ["1234567890987654400","-1234567890987654400"] end
null
true
. < 0.12345678901234567890123456788
0.12345678901234567890123456789
false
map([., . == 1]) | tojson | . == if have_decnum then "[[1,true],[1.000,true],[1.0,true],[1.00,true]]" else "[[1,true],[1,true],[1,true],[1,true]]" end
map([., . == 1]) | tojson == if have_decnum then "[[1,true],[1.000,true],[1.0,true],[1.00,true]]" else "[[1,true],[1,true],[1,true],[1,true]]" end
[1, 1.000, 1.0, 100e-2]
true