Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: PowerPC Numerics / Part 2 - The PowerPC Numerics C Implementation
Chapter 7 - Numeric Data Types in C


Numeric Data Types Summary

This section summarizes the C constants, macros, functions, and type definitions associated with creating floating-point values or determining the class and sign of a floating-point value.

C Summary

Constants

#ifdef   powerc
#define           LONG_DOUBLE_SIZE     16
#elif    mc68881
#define           LONG_DOUBLE_SIZE     12
#else
#define           LONG_DOUBLE_SIZE     10
#endif      /* powerc */
#define           HUGE_VAL             __inf()
#define           INFINITY             __inf()
#define           NAN                  nan("255")

Class and Sign Inquiry Macros

#define  fpclassify  (x)   ((    sizeof (x) == LONG_DOUBLE_SIZE)     ?  \
                                 __fpclassify  (x)                   :  \
                                 (sizeof (x) == DOUBLE_SIZE)         ?  \
                                 __fpclassifyd (x)                   :  \
                                 __fpclassifyf (x))
#define  isnormal    (x)   ((    sizeof (x) == LONG_DOUBLE_SIZE)     ?  \
                                 __isnormal (x)                      :  \
                                 (sizeof (x) == DOUBLE_SIZE)         ?  \
                                 __isnormald (x)                     :  \
                                 __isnormalf (x))
#define  isfinite    (x)   ((    sizeof (x) == LONG_DOUBLE_SIZE)     ?  \
                                 __isfinite (x)                      :  \
                                 ( sizeof (x) == DOUBLE_SIZE)        ?  \
                                 __isfinited (x)                     :  \
                                 __isfinitef (x))
#define  isnan       (x)   ((    sizeof (x) == LONG_DOUBLE_SIZE)     ?  \
                                 __isnan (x)                         :  \
                                 (sizeof (x) == DOUBLE_SIZE)         ?  \
                                 __isnand (x)                        :  \
                                 __isnanf (x))
#define  signbit     (x)   ((    sizeof (x) == LONG_DOUBLE_SIZE)     ?  \
                                 __signbit (x)                       :  \
                                 (sizeof (x) == DOUBLE_SIZE)         ?  \
                                 __signbitd (x)                      :  \
                                 __signbitf (x))

Data Types

enum NumberKind
{
   FP_SNAN = 0,                  /* signaling NaN */
   FP_QNAN,                      /* quiet NaN */
   FP_INFINITE,                  /* + or - infinity */
   FP_ZERO,                      /* + or - zero */
   FP_NORMAL,                    /* all normal numbers */
   FP_SUBNORMAL                  /* denormal numbers */
};
#ifdef   powerpc
   typedef float float_t;
   typedef double double_t;
#else
   typedef long double float_t;
   typedef long double double_t;
#endif      /* powerpc */

Special Value Routines

Creating NaNs

double nan(const char *tagp);


Previous Book Contents Book Index Next

© Apple Computer, Inc.
13 JUL 1996