mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-26 05:00:28 +02:00
Use scientific notation only if there are enough trailing zeroes.
* libguile/numbers.c (idbl2str): Print large numbers in scientific notation only if the exponent is >= 7 and the least significant non-zero digit has value >= radix^4. * test-suite/tests/numbers.test ("number->string"): Add tests.
This commit is contained in:
parent
a9ea4f909b
commit
8150dfa1f2
2 changed files with 50 additions and 17 deletions
|
@ -1429,6 +1429,10 @@
|
|||
(pass-if (string=? (number->string 35 36) "z"))
|
||||
(pass-if (= (num->str->num 35 36) 35))
|
||||
|
||||
(pass-if (string=? (number->string 12342342340000.0) "1.234234234e13"))
|
||||
(pass-if (string=? (number->string 1234234234000.0) "1234234234000.0"))
|
||||
(pass-if (string=? (number->string 1240000.0) "1240000.0"))
|
||||
|
||||
(with-test-prefix "powers of radix"
|
||||
(for-each
|
||||
(lambda (radix)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue