

strtod()                 General Function                strtod()




Convert string to floating-point number

#iinncclluuddee <ssttddlliibb.hh>
ddoouubbllee ssttrrttoodd(_s_t_r_i_n_g, _t_a_i_l_p_t_r)
cchhaarr *_s_t_r_i_n_g; cchhaarr **_t_a_i_l_p_t_r;

ssttrrttoodd converts the  number given in _s_t_r_i_n_g to a double-precision
floating-point  number  and  returns its  value.   It  is a  more
general  version  of  the function  aattooff.  ssttrrttoodd  also stores  a
pointer  to  the first  character  following  the number  through
_t_a_i_l_p_t_r, provided _t_a_i_l_p_t_r is not NNUULLLL.

ssttrrttoodd parses  the input  _s_t_r_i_n_g into three  portions: beginning,
subject sequence, and tail.

The  _b_e_g_i_n_n_i_n_g consists  of zero  or more  white-space characters
that begin the string.

The  _s_u_b_j_e_c_t _s_e_q_u_e_n_c_e  is the  portion of  the input  _s_t_r_i_n_g that
ssttrrttoodd converts into  a floating-point number.  It consists of an
optional sign  character, a  nonempty sequence of  decimal digits
optionally including  a decimal-point character,  and an optional
exponent.  If present, the exponent consists of either `e' or `E'
followed by  an optional sign and a  nonempty sequence of decimal
digits.   ssttrrttoodd reads  characters until  it encounters  either a
second decimal-point  character or exponent marker,  or any other
non-numeral.

The _t_a_i_l  continues from the  end of the subject  sequence to the
null character that ends the string.

ssttrrttoodd ignores the  beginning portion of the string.  It converts
the subject  sequence to a double-precision  number.  Finally, it
sets  the pointer  pointed to  by _t_a_i_l_p_t_r to  the address  of the
first character of the string's tail.

ssttrrttoodd returns  the ddoouubbllee  generated from the  subject sequence.
If no  subject sequence could be recognized,  it returns zero and
stores the initial value of _s_t_r_i_n_g through _t_a_i_l_p_t_r. If the number
represented by the subject sequence  is too large or too small to
fit into a ddoouubbllee, then  ssttrrttoodd sets the global constant eerrrrnnoo to
EERRAANNGGEE and returns HHUUGGEE_VVAALL or zero, respectively.

***** See Also *****

aattooff,  ddoouubbllee,  eerrrrnnoo,  ggeenneerraall  ffuunnccttiioonnss,  lliimmiittss.hh,  ssttddlliibb.hh,
ssttrrttooll, ssttrrttoouull

***** Notes *****

ssttrrttoodd ignores  initial white space  in the string  pointed to by
_s_t_r_i_n_g;  white  space  is  defined  as  being all  characters  so
recognized by the function iissssppaaccee.



COHERENT Lexicon                                           Page 1


