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 8 - Environmental Control Functions


Environmental Controls Summary

This section summarizes the C constants, macros, functions, and type definitions associated with controlling the floating-point environment.

C Summary

Constants

Rounding Direction Modes

#define  FE_TONEAREST      0x00000000 
#define  FE_TOWARDZERO     0x00000001 
#define  FE_UPWARD         0x00000002 
#define  FE_DOWNWARD       0x00000003

Floating-Point Exception Flags

#define  FE_INEXACT        0x02000000     /* inexact */
#define  FE_DIVBYZERO      0x04000000     /* divide-by-zero */
#define  FE_UNDERFLOW      0x08000000     /* underflow */
#define  FE_OVERFLOW       0x10000000     /* overflow */
#define  FE_INVALID        0x20000000     /* invalid */
#define  FE_ALL_EXCEPT     (  FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | \
                              FE_OVERFLOW | FE_INVALID )
#define  FE_DFL_ENV        &_FE_DFL_ENV   /* pointer to default environment*/

Data Types

typedef     long int    fenv_t;
typedef     long int    fexcept_t;

Environment Access Routines

Controlling the Rounding Direction

int fegetround(void);
int fesetround(int round);

Controlling the Exception Flags

void feclearexcept(int excepts);
void fegetexcept(fexcept_t *flagp, int excepts);
void feraiseexcept(int excepts);
void fesetexcept(const fexcept_t *flagp, int excepts);
int fetestexcept(int excepts);

Accessing the Floating-Point Environment

void fegetenv (fenv_t *envp);
int feholdexcept (fenv_t *envp);
void fesetenv (const fenv_t *envp);
void feupdateenv (const fenv_t *envp);


Previous Book Contents Book Index Next

© Apple Computer, Inc.
13 JUL 1996