to_number

Definition: object res = to_number(string s, object failure={})
Description: Converts a string representation of a number into an atom.

s: A string such as "42".

Returns the atom equivalent of s, or the specified failure value.
Comments: Copes with signs, fractions, exponents, other number bases, and values outside 0..#3FFFFFFF.

Note that unlike the simpler to_integer(), the empty string yields failure, and embedded underscores ('_') are permitted/skipped.
This routine also allows eg "65'A'" which is treated as if it was just "65" (but "66'A'" and "65'B'" would fail), specifically intended to help when processing ex.err files.

Also note that there is no equivalent of the return_bad_pos argument of the OpenEuphoria version.

This routine is defined in builtins/scanf.e (an autoinclude).
Example:
?to_number("12")                            -- 12
?to_number("-12")                           -- -12
?to_number("0b1100")                        -- 12
?to_number("1_000_000")                     -- 1000000
?to_number("13.25e-57")                     -- 13.25e-57