Embedded Artistry libc
C Standard Library Support for Bare-metal Systems
atof.c File Reference
#include <stdlib.h>
Include dependency graph for atof.c:

Go to the source code of this file.

Functions

double atof (const char *ascii)
 Interprets a floating-point value in a byte string pointed to by str. More...
 

Function Documentation

◆ atof()

double atof ( const char *  str)

Interprets a floating-point value in a byte string pointed to by str.

Interprets a floating-point value in a byte string pointed to by str. Function discards any whitespace characters (as determined by

See also
isspace() until first non-whitespace character is found. Then it takes as many characters as possible to form a valid floating-point representation and converts them to a floating-point value. The valid floating-point value can be one of the following: 1) decimal floating-point expression. It consists of the following parts: a) (optional) plus or minus sign b) nonempty sequence of decimal digits optionally containing decimal-point character c) (optional) e or E followed with optional minus or plus sign and nonempty sequence of decimal digits (defines exponent)
Parameters
strpointer to the null-terminated byte string to be interpreted
Returns
double value corresponding to the contents of str on success. If the converted value falls out of range of corresponding return type, the return value is undefined. If no conversion can be performed, ​0​.0 is returned.

Definition at line 57 of file atof.c.

58 {
59  return (strtod(ascii, NULL));
60 }
#define NULL
Definition: stddef.h:15
double strtod(const char *__restrict str, char **__restrict str_end)
Interprets a floating-point value in a byte string pointed to by str.

References NULL, and strtod().