[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Exposing `scm_i_mem2number ()'
From: |
Ludovic Courtès |
Subject: |
Re: Exposing `scm_i_mem2number ()' |
Date: |
Thu, 16 Mar 2006 11:07:52 +0100 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) |
Hi,
About `scm_c_locale_string_to_number ()'...
address@hidden (Ludovic Courtès) writes:
> While writing it, it occurred to me that R5RS does not make it clear
> whether `string->number' converts from a number's external
> representation or not.
As discussed in [0], while R5RS does not explicitly state that
`string->number' converts from a number's external representation, it
makes a connection with `number->string' which in turn explicitly
converts to a number's external representation:
- procedure: number->string z
- procedure: number->string z radix
RADIX must be an exact integer, either 2, 8, 10, or 16. If
omitted, RADIX defaults to 10. The procedure `number->string'
takes a number and a radix and returns as a string an external
representation of the given number in the given radix such that
(let ((number NUMBER)
(radix RADIX))
(eqv? number
(string->number (number->string number
radix)
radix)))
is true. It is an error if no possible result makes this
expression true.
So the additional bit of documentation I suggested in my previous post
(stating that `locale' in `scm_c_locale_string_to_number ()' has nothing
to do with the number representation) is acceptable.
Can someone comment on it or commit it?
Thanks,
Ludovic.
[0]
http://groups.google.com/group/comp.lang.scheme/tree/browse_frm/thread/dc6a98bbc7cda398/7490c0724e5eb305?rnum=1&hl=eo&q=string-%3Enumber+group%3Acomp.lang.scheme&_done=%2Fgroup%2Fcomp.lang.scheme%2Fbrowse_frm%2Fthread%2Fdc6a98bbc7cda398%2F5de6eb2de0105bdb%3Flnk%3Dst%26q%3Dstring-%3Enumber+group%3Acomp.lang.scheme%26rnum%3D1%26hl%3Deo%26#doc_13b48a9567f63165