[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |

#### 6.6.2.9 Converting Numbers To and From Strings

The following procedures read and write numbers according to their
external representation as defined by R5RS (see R5RS Lexical Structure in The Revised^5 Report on the Algorithmic Language Scheme). See section the `(ice-9 i18n)`

module, for locale-dependent number parsing.

- Scheme Procedure:
**number->string***n [radix]* - C Function:
**scm_number_to_string***(n, radix)* Return a string holding the external representation of the number

`n`in the given`radix`. 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)* Return a number of the maximally precise representation expressed by the given

`string`.`radix`must be an exact integer, either 2, 8, 10, or 16. If supplied,`radix`is a default radix that may be overridden by an explicit radix prefix in`string`(e.g. "#o177"). If`radix`is not supplied, then the default radix is 10. If string is not a syntactically valid notation for a number, then`string->number`

returns`#f`

.

- C Function:
*SCM***scm_c_locale_stringn_to_number***(const char *string, size_t len, unsigned radix)* As per

`string->number`

above, but taking a C string, as pointer and length. The string characters should be in the current locale encoding (`locale`

in the name refers only to that, there’s no locale-dependent parsing).

[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |

This document was generated on *April 20, 2013* using *texi2html 5.0*.