Next: , Previous: math library predicates, Up: math


D.11.3 math library conversion functions

The conversion function strtod takes a string representing a floating point number in C format to its representation. This function is the primary means of creating or initializing floating point numbers in virtual code. A value of floating point 0.0 is returned if the string is not valid, but no exception is raised.

The conversion asprintf is similar to the one by that name in C, but requires a pair (f,x) as an argument. The left side f is a character string containing a C style format conversion for exactly one double precision floating point number, such as '%0.4e', and the parameter x is a floating point number. The result returned will be a character string expressing the number in the specified format.