STOF is a CAOS command which converts between strings and floats.


Syntax: STOF str (string)

Returns the integer made from converting str. str is in the format [whitespace][+|-][nn][.nn][e|E[+|-][nn]] where nn may be any length. The number following e is the exponent. In the event of an error 0.0 is returned.

If a string of the above format begins str but something is attached to the end, the string is truncated at the end of the well-formatted portion.

The following case-insensitive special values are also accepted: "nan", "[+|-]inf". These correspond to the obvious special float values.

This command is exactly equivalent to C's atof() function.


OUTV STOF "       -12.34e+5"

See also

  • SETS
  • VTOS goes the other way
  • STOI does the same for integers

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.