File:  [MW Coherent from dump] / coherent / a / usr / man / MULTI / strtod
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:34 2019 UTC (7 years ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent



strtod()                 General Function                strtod()




Convert string to floating-point number

#iinncclluuddee <ssttddlliibb.hh>
ddoouubbllee ssttrrttoodd(_s_t_r_i_n_g, _t_a_i_l_p_t_r)
cchhaarr *_s_t_r_i_n_g; cchhaarr **_t_a_i_l_p_t_r;

ssttrrttoodd 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  aattooff.  ssttrrttoodd  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 NNUULLLL.

ssttrrttoodd 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
ssttrrttoodd 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.   ssttrrttoodd 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.

ssttrrttoodd 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.

ssttrrttoodd returns  the ddoouubbllee  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 ddoouubbllee, then  ssttrrttoodd sets the global constant eerrrrnnoo to
EERRAANNGGEE and returns HHUUGGEE_VVAALL or zero, respectively.

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

aattooff,  ddoouubbllee,  eerrrrnnoo,  ggeenneerraall  ffuunnccttiioonnss,  lliimmiittss.hh,  ssttddlliibb.hh,
ssttrrttooll, ssttrrttoouull

***** Notes *****

ssttrrttoodd 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 iissssppaaccee.



COHERENT Lexicon                                           Page 1



unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.