Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ dec2flt(3) — Atari System V 1.1-06

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

scanf(3S)

strtod(3C)





   decimal_to_floating(3)  (BSD Compatibility Package)  decimal_to_floating(3)


   NAME
         decimaltofloating:  decimaltosingle, decimaltodouble,
         decimaltoextended - convert decimal record to floating-point value

   SYNOPSIS
         cc [ flag... ] file ...  -lucb
         #include <floatingpoint.h>

         void decimaltosingle(px, pm, pd, ps)
         single *px ;
         decimalmode *pm;
         decimalrecord *pd;
         fpexceptionfieldtype *ps;

         void decimaltodouble(px, pm, pd, ps)
         double *px ;
         decimalmode *pm;
         decimalrecord *pd;
         fpexceptionfieldtype *ps;

         void decimaltoextended(px, pm, pd, ps)
         extended *px ;
         decimalmode *pm;
         decimalrecord *pd;
         fpexceptionfieldtype *ps;

   DESCRIPTION
         The decimaltofloating 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->sign and pd->fpclass are always taken into account.  pd->exponent
         and pd->ds are used when pd->fpclass is fp_normal or fp_subnormal.
         In these cases pd->ds must contain one or more ASCII digits followed
         by a NULL.  *px is set to a correctly rounded approximation to

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

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

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




   8/91                                                                 Page 1









   decimal_to_floating(3)  (BSD Compatibility Package)  decimal_to_floating(3)


         pd->ndigits, pm->df, and pm->ndigits are not used.

         strtod(3C), scanf(3S), fscanf(), and sscanf() all use
         decimaltodouble.

   SEE ALSO
         scanf(3S), strtod(3C) in the Programmer's Reference Manual.














































   Page 2                                                                 8/91





Typewritten Software • bear@typewritten.org • Edmonds, WA 98026