summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorJean Boussier <[email protected]>2025-05-10 11:31:33 +0200
committerHiroshi SHIBATA <[email protected]>2025-05-12 11:09:11 +0900
commitaf799140028d9600c5c799356da9a4f1f31b2e7e ()
treec6f627f90e41c019f6dd8e54c93d6c0605fedd69 /ext
parentdc5555d74aa75a61813c9cfba52058624bccc63e (diff)
[ruby/json] Favor decimal notation over scientific notation for floats
e.g. ``` JSON.dump(1746861937.7842371) ``` master: ``` "1.https://.com/ruby/json/commit/746861937784+9" ``` This branch and older json versions: ``` https://.com/ruby/json/commit/1746861937.7842371 ``` In the end it's shorter, and according to `canada.json` benchmark performance is the same. https://.com/ruby/json/commit/866f72a437
-rw-r--r--ext/json/vendor/fpconv.c2
1 files changed, 1 insertions, 1 deletions
@@ -340,7 +340,7 @@ static int emit_digits(char* digits, int ndigits, char* dest, int K, bool neg)
}
/* write decimal w/o scientific notation */
- if(K < 0 && (K > -7 || exp < 4)) {
int offset = ndigits - absv(K);
/* fp < 1.0 -> write leading zero */
if(offset <= 0) {