For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).
atof
atof(str_slice: StringSlice) -> Float64
Parses the given string as a floating point and returns that value.
For example, atof("2.25") returns 2.25.
This function is in the prelude, so you don't need to import it.
Args:
- str_slice (
StringSlice): A string to be parsed as a floating point.
Returns:
Float64: A floating-point value that represents the string.
Raises:
If the given string cannot be parsed as an floating-point value, for
example in atof("hi").