unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (SunOS-4.1.3)
Page:
Section:
Apropos / Subsearch:
optional field

DECIMAL_TO_FLOATING(3)     Library Functions Manual     DECIMAL_TO_FLOATING(3)



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

SYNOPSIS
       #include <&lt;floatingpoint.h>&gt;

       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  *pd
       into  a  floating-point  value at *px, observing the modes specified in
       *pm and setting exceptions in *ps.  If there are  no  IEEE  exceptions,
       *ps will be zero.

       pd-&gt;sign  and  pd-&gt;fpclass are always taken into account.  pd-&gt;exponent
       and pd-&gt;ds are used when pd-&gt;fpclass is fp_normal or fp_subnormal.   In
       these  cases pd-&gt;ds must contain one or more ascii digits followed by a
       null character.  *px is set to a correctly rounded approximation to

              (pd->&gt;sign)*(pd->&gt;ds)*10**(pd->&gt;exponent)

       Thus if pd-&gt;exponent == -2 and pd-&gt;ds == "1234",  *px  will  get  12.34
       rounded  to  storage  precision.   pd-&gt;ds  cannot  have more than DECI-
       MAL_STRING_LENGTH-1 significant digits because one character is used to
       terminate  the string with a null character.  If pd-&gt;more != 0 on input
       then additional nonzero digits follow those in  pd-&gt;ds;  fp_inexact  is
       set accordingly on output in *ps.

       *px  is  correctly  rounded  according  to  the  IEEE rounding modes in
       pm-&gt;rd.  *ps is set to contain fp_inexact, fp_underflow, or fp_overflow
       if any of these arise.

       pd-&gt;ndigits, pm-&gt;df, and pm-&gt;ndigits are not used.

       strtod(3),  scanf(3V),  fscanf(),  and sscanf() all use decimal_to_dou-
       ble().

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



                                23 October 1987         DECIMAL_TO_FLOATING(3)