strtod()

Syntax
  #include <stdlib.h>

  
  double strtod(const char *s, char **end);

  
Description

strtod() converts string s into a floating point number, skipping over any white space at the beginning of s. It stops scanning when it reaches a character not matching the required syntax and returns a pointer to that character in *end. The number format strtod() accepts is:

  FloatNum = Sign{Digit}[.{Digit}][Exp] 
  
  Sign = [+|-] 
  
  Exp = (e|E) SignDigit{Digit} 
  
  Digit = <any decimal digit from 0 to 9> 
  
Return

The floating point number read. If an underflow occurred, 0.0 is returned. If the value causes an overflow, HUGE_VAL is returned. In both cases, errno is set to ERANGE.

See also

atof(),

scanf(),

strtol(), and

strtoul()