cs: disable non-decimal string->number
on inexacts
This commit is contained in:
parent
77bcfde77c
commit
8e1b27592f
|
@ -329,6 +329,13 @@
|
||||||
(check who (lambda (radix) #f)
|
(check who (lambda (radix) #f)
|
||||||
:contract "(or/c 2 8 10 16)"
|
:contract "(or/c 2 8 10 16)"
|
||||||
radix))
|
radix))
|
||||||
|
(when (and (not (eq? radix 10)) (inexact? n))
|
||||||
|
(raise
|
||||||
|
(exn:fail:contract (string-append
|
||||||
|
"number->string: inexact numbers can only be printed in base 10\n"
|
||||||
|
" number: " (number->string n) "\n"
|
||||||
|
" requested base: " (number->string radix))
|
||||||
|
(current-continuation-marks))))
|
||||||
(do-number->string n radix)]
|
(do-number->string n radix)]
|
||||||
[(n)
|
[(n)
|
||||||
(do-number->string n 10)]))
|
(do-number->string n 10)]))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user