[erlang-questions] string:to_float/1 behavior

Serge Aleynikov serge@REDACTED
Wed Jan 12 18:20:06 CET 2011


It is a BIF.  Look here:

	emulator/beam/bif.tab

It does handle both "." and "," cases - this is hardcoded in the 
implementation.

On 1/12/2011 10:11 AM, Alexey Romanov wrote:
> 1) Where can I find its source? It isn't defined in
> lib/stdlib-1.17.1/src/string.erl. I thought it must be a BIF, but "ack
> to_float /usr/local/lib/erlang/" doesn't seem to find anything
> relevant. The full output is at https://gist.github.com/776256, but 1)
> the only C function found is in
> lib/erl_interface-3.7.1/src/legacy/erl_marshal.c; 2) the Erlang code
> doesn't seem to define any mapping for this name.
>
> 2) The reason I went looking for its code is to check whether it is
> guaranteed to deal with both "." and "," as decimal separators,
> independent of locale? It does on my machine (with
> LC_NUMERIC="en_US.UTF-8") but the string module documentation doesn't
> say anything.
>
> Yours, Alexey Romanov
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>


More information about the erlang-questions mailing list