|
|
1.1 ! root 1: ! 2: ! 3: strtod() General Function strtod() ! 4: ! 5: ! 6: ! 7: ! 8: Convert string to floating-point number ! 9: ! 10: #iinncclluuddee <ssttddlliibb.hh> ! 11: ddoouubbllee ssttrrttoodd(_s_t_r_i_n_g, _t_a_i_l_p_t_r) ! 12: cchhaarr *_s_t_r_i_n_g; cchhaarr **_t_a_i_l_p_t_r; ! 13: ! 14: ssttrrttoodd converts the number given in _s_t_r_i_n_g to a double-precision ! 15: floating-point number and returns its value. It is a more ! 16: general version of the function aattooff. ssttrrttoodd also stores a ! 17: pointer to the first character following the number through ! 18: _t_a_i_l_p_t_r, provided _t_a_i_l_p_t_r is not NNUULLLL. ! 19: ! 20: ssttrrttoodd parses the input _s_t_r_i_n_g into three portions: beginning, ! 21: subject sequence, and tail. ! 22: ! 23: The _b_e_g_i_n_n_i_n_g consists of zero or more white-space characters ! 24: that begin the string. ! 25: ! 26: 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 ! 27: ssttrrttoodd converts into a floating-point number. It consists of an ! 28: optional sign character, a nonempty sequence of decimal digits ! 29: optionally including a decimal-point character, and an optional ! 30: exponent. If present, the exponent consists of either `e' or `E' ! 31: followed by an optional sign and a nonempty sequence of decimal ! 32: digits. ssttrrttoodd reads characters until it encounters either a ! 33: second decimal-point character or exponent marker, or any other ! 34: non-numeral. ! 35: ! 36: The _t_a_i_l continues from the end of the subject sequence to the ! 37: null character that ends the string. ! 38: ! 39: ssttrrttoodd ignores the beginning portion of the string. It converts ! 40: the subject sequence to a double-precision number. Finally, it ! 41: sets the pointer pointed to by _t_a_i_l_p_t_r to the address of the ! 42: first character of the string's tail. ! 43: ! 44: ssttrrttoodd returns the ddoouubbllee generated from the subject sequence. ! 45: If no subject sequence could be recognized, it returns zero and ! 46: stores the initial value of _s_t_r_i_n_g through _t_a_i_l_p_t_r. If the number ! 47: represented by the subject sequence is too large or too small to ! 48: fit into a ddoouubbllee, then ssttrrttoodd sets the global constant eerrrrnnoo to ! 49: EERRAANNGGEE and returns HHUUGGEE_VVAALL or zero, respectively. ! 50: ! 51: ***** See Also ***** ! 52: ! 53: aattooff, ddoouubbllee, eerrrrnnoo, ggeenneerraall ffuunnccttiioonnss, lliimmiittss.hh, ssttddlliibb.hh, ! 54: ssttrrttooll, ssttrrttoouull ! 55: ! 56: ***** Notes ***** ! 57: ! 58: ssttrrttoodd ignores initial white space in the string pointed to by ! 59: _s_t_r_i_n_g; white space is defined as being all characters so ! 60: recognized by the function iissssppaaccee. ! 61: ! 62: ! 63: ! 64: COHERENT Lexicon Page 1 ! 65: ! 66:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.