Next: , Previous: Comparison, Up: Numbers


21.2.9 Converting Numbers To and From Strings

— Scheme Procedure: number->string n [radix]
— C Function: scm_number_to_string (n, radix) |1 |1 |0

Return a string holding the external representation of the number n in the given radix (an integer in the range 2 − 36, inclusive). If n is inexact, a radix of 10 will be used.

— Scheme Procedure: string->number string [radix]
— C Function: scm_string_to_number (string, radix) |1 |1 |0

Return a number of the maximally precise representation expressed by the given string. If given, radix is a default radix (an exact integer, one of 2, 8, 10 or 16) that may be overridden by an explicit radix prefix in string (e.g. "#o177"). If radix is not specified, then the default radix is 10. If string is not a syntactically valid notation for a number, then return #f. (r5rs)