// fenv.h — floating-point environment. // // The W65816 softFloat / softDouble runtime is fixed at round-to- // nearest-even (FE_TONEAREST). Other rounding modes can be set/queried // but they have no effect on softFloat output — softDouble always uses // RNE. Exception flags are tracked as a static word but never raised // by the soft-float libraries (they don't model overflow/underflow/ // inexact at the IEEE level; overflow → infinity, underflow → zero, // inexact silently rounded). // // All functions return 0 on success (per C99 7.6.3.1). // // This header exists so portable code that includes and calls // fegetround() / fesetround() compiles cleanly — it just won't observe // non-default rounding. #ifndef _FENV_H #define _FENV_H typedef unsigned short fenv_t; typedef unsigned short fexcept_t; // Rounding modes. Only FE_TONEAREST has effect on this target. #define FE_TONEAREST 0 #define FE_DOWNWARD 1 #define FE_UPWARD 2 #define FE_TOWARDZERO 3 // Exception flags. Never raised by softFloat/softDouble. #define FE_INVALID 0x01 #define FE_DIVBYZERO 0x02 #define FE_OVERFLOW 0x04 #define FE_UNDERFLOW 0x08 #define FE_INEXACT 0x10 #define FE_ALL_EXCEPT (FE_INVALID|FE_DIVBYZERO|FE_OVERFLOW|FE_UNDERFLOW|FE_INEXACT) #define FE_DFL_ENV ((const fenv_t *)0) int feclearexcept(int excepts); int fegetexceptflag(fexcept_t *flagp, int excepts); int feraiseexcept(int excepts); int fesetexceptflag(const fexcept_t *flagp, int excepts); int fetestexcept(int excepts); int fegetround(void); int fesetround(int round); int fegetenv(fenv_t *envp); int feholdexcept(fenv_t *envp); int fesetenv(const fenv_t *envp); int feupdateenv(const fenv_t *envp); #endif