cs: faster number->string
on flonums
This commit is contained in:
parent
43c8876643
commit
07d3f3a2ec
|
@ -179,6 +179,8 @@
|
|||
(test "+nan.0" number->string +nan.0)
|
||||
(test "+nan.0" number->string +nan.0)
|
||||
|
||||
(test "1589935744527.254" number->string 1589935744527.254)
|
||||
|
||||
#reader "maybe-single.rkt"
|
||||
(begin
|
||||
(test (if has-single-flonum? "+inf.f" "+inf.0") number->string +inf.f)
|
||||
|
|
|
@ -393,6 +393,13 @@
|
|||
result)]
|
||||
[else
|
||||
(cond
|
||||
[(and (eq? radix 10)
|
||||
(number? n))
|
||||
;; `number->string` goes through `format` to get to an implementation
|
||||
;; like this, so take a shortcut:
|
||||
(let ([op (#%open-output-string)])
|
||||
(#%display n op)
|
||||
(#%get-output-string op))]
|
||||
[(eq? radix 16)
|
||||
;; Host generates uppercase letters, Racket generates lowercase
|
||||
(string-downcase (#2%number->string n radix))]
|
||||
|
|
Loading…
Reference in New Issue
Block a user