


DECIMAL_TO_FLOATING(3) C LIBRARY FUNCTIONS DECIMAL_TO_FLOATING(3)



NAME
     decimal_to_single, decimal_to_double, decimal_to_extended  -
     convert decimal record to floating-point value

SYNOPSIS
     #include <floatingpoint.h>

     void decimal_to_single(px, pm, pd, ps)
     single *px ;
     decimal_mode *pm;
     decimal_record *pd;
     fp_exception_field_type *ps;

     void decimal_to_double(px, pm, pd, ps)
     double *px ;
     decimal_mode *pm;
     decimal_record *pd;
     fp_exception_field_type *ps;

     void decimal_to_extended(px, pm, pd, ps)
     extended *px ;
     decimal_mode *pm;
     decimal_record *pd;
     fp_exception_field_type *ps;

DESCRIPTION
     The  decimal_to_floating()  functions  convert  the  decimal
     record  at *_p_d into a floating-point value at *_p_x, observing
     the modes specified in *_p_m and setting  exceptions  in  *_p_s.
     If there are no IEEE exceptions, *_p_s will be zero.

     _p_d->_s_i_g_n and _p_d->_f_p_c_l_a_s_s  are  always  taken  into  account.
     _p_d->_e_x_p_o_n_e_n_t   and  _p_d->_d_s  are  used  when  _p_d->_f_p_c_l_a_s_s  is
     _f_p__n_o_r_m_a_l or _f_p__s_u_b_n_o_r_m_a_l.  In these cases _p_d->_d_s must  con-
     tain  one or more ascii digits followed by a null character.
     *_p_x is set to a correctly rounded approximation to

          (pd->sign)*(pd->ds)*10**(pd->exponent)

     Thus if _p_d->_e_x_p_o_n_e_n_t == -2 and _p_d->_d_s ==  "1234",  *_p_x  will
     get  12.34 rounded to storage precision.  _p_d->_d_s cannot have
     more than DECIMAL_STRING_LENGTH-1 significant digits because
     one  character  is  used to terminate the string with a null
     character.  If  _p_d->_m_o_r_e  !=  _0  on  input  then  additional
     nonzero  digits  follow  those  in _p_d->_d_s; _f_p__i_n_e_x_a_c_t is set
     accordingly on output in *_p_s.

     *_p_x is correctly rounded  according  to  the  IEEE  rounding
     modes   in  _p_m->_r_d.   *_p_s  is  set  to  contain  _f_p__i_n_e_x_a_c_t,
     _f_p__u_n_d_e_r_f_l_o_w, or _f_p__o_v_e_r_f_l_o_w if any of these arise.





Sun Release 4.1   Last change: 23 October 1987                  1






DECIMAL_TO_FLOATING(3) C LIBRARY FUNCTIONS DECIMAL_TO_FLOATING(3)



     _p_d->_n_d_i_g_i_t_s, _p_m->_d_f, and _p_m->_n_d_i_g_i_t_s are not used.

     strtod(3),  scanf(3V),  fscanf(),  and  sscanf()   all   use
     decimal_to_double().

SEE ALSO
     scanf(3V), strtod(3)
















































Sun Release 4.1   Last change: 23 October 1987                  2



