ieeefp.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* -
  2. * Written by J.T. Conklin, Apr 6, 1995
  3. * Public domain.
  4. * $NetBSD: ieeefp.h,v 1.2 1999/07/07 01:52:26 danw Exp $
  5. * $FreeBSD$
  6. */
  7. #ifndef _MACHINE_IEEEFP_H_
  8. #define _MACHINE_IEEEFP_H_
  9. /* Deprecated historical FPU control interface */
  10. typedef int fp_except_t;
  11. #ifdef __SPE__
  12. #define FP_X_OFL 0x01 /* overflow exception */
  13. #define FP_X_UFL 0x02 /* underflow exception */
  14. #define FP_X_DZ 0x04 /* divide-by-zero exception */
  15. #define FP_X_INV 0x08 /* invalid operation exception */
  16. #define FP_X_IMP 0x10 /* imprecise (loss of precision) */
  17. #else
  18. #define FP_X_IMP 0x01 /* imprecise (loss of precision) */
  19. #define FP_X_DZ 0x02 /* divide-by-zero exception */
  20. #define FP_X_UFL 0x04 /* underflow exception */
  21. #define FP_X_OFL 0x08 /* overflow exception */
  22. #define FP_X_INV 0x10 /* invalid operation exception */
  23. #endif
  24. typedef enum {
  25. FP_RN=0, /* round to nearest representable number */
  26. FP_RZ=1, /* round to zero (truncate) */
  27. FP_RP=2, /* round toward positive infinity */
  28. FP_RM=3 /* round toward negative infinity */
  29. } fp_rnd_t;
  30. __BEGIN_DECLS
  31. extern fp_rnd_t fpgetround(void);
  32. extern fp_rnd_t fpsetround(fp_rnd_t);
  33. extern fp_except_t fpgetmask(void);
  34. extern fp_except_t fpsetmask(fp_except_t);
  35. extern fp_except_t fpgetsticky(void);
  36. __END_DECLS
  37. #endif /* _MACHINE_IEEEFP_H_ */