New header file <ieeefp.h>, which provides a API for getting and setting

IEEE rounding mode, exception enable flags, and exception sticky flags.
This commit is contained in:
jtc 1995-04-07 00:59:09 +00:00
parent 7a5da7fda2
commit a9ae458fc3
2 changed files with 51 additions and 5 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.52 1995/02/17 09:08:08 jtc Exp $ # $NetBSD: Makefile,v 1.53 1995/04/07 00:59:09 jtc Exp $
# @(#)Makefile 5.45.1.1 (Berkeley) 5/6/91 # @(#)Makefile 5.45.1.1 (Berkeley) 5/6/91
@ -10,10 +10,10 @@
# Missing: mp.h # Missing: mp.h
FILES= a.out.h ar.h assert.h bitstring.h bm.h ctype.h db.h dirent.h disktab.h \ FILES= a.out.h ar.h assert.h bitstring.h bm.h ctype.h db.h dirent.h disktab.h \
err.h fnmatch.h fstab.h fts.h glob.h grp.h iso646.h kvm.h langinfo.h \ err.h fnmatch.h fstab.h fts.h glob.h grp.h ieeefp.h iso646.h kvm.h \
limits.h locale.h math.h memory.h mpool.h ndbm.h netdb.h netgroup.h \ langinfo.h limits.h locale.h math.h memory.h mpool.h ndbm.h netdb.h \
nlist.h nl_types.h paths.h pwd.h ranlib.h regex.h regexp.h resolv.h \ netgroup.h nlist.h nl_types.h paths.h pwd.h ranlib.h regex.h regexp.h \
search.h setjmp.h sgtty.h signal.h stab.h stddef.h \ resolv.h search.h setjmp.h sgtty.h signal.h stab.h stddef.h \
stdio.h stdlib.h string.h strings.h struct.h sysexits.h time.h \ stdio.h stdlib.h string.h strings.h struct.h sysexits.h time.h \
ttyent.h tzfile.h unistd.h utime.h utmp.h vis.h malloc.h \ ttyent.h tzfile.h unistd.h utime.h utmp.h vis.h malloc.h \
link.h link.h

46
include/ieeefp.h Normal file
View File

@ -0,0 +1,46 @@
/*
* Written by J.T. Conklin, Apr 6, 1995
* Public domain.
*/
#ifndef _IEEEFP_H_
#define _IEEEFP_H_
#include <sys/cdefs.h>
typedef int fp_except;
#ifdef __i386__
#define FP_X_INV 0x01 /* invalid operation exception */
#define FP_X_DNML 0x02 /* denormalization exception */
#define FP_X_DZ 0x04 /* divide-by-zero exception */
#define FP_X_OFL 0x08 /* overflow exception */
#define FP_X_UFL 0x10 /* underflow exception */
#define FP_X_IMP 0x20 /* imprecise (loss of precision) */
#endif
#if defined(__i386__)
typedef enum {
FP_RN=0, /* round to nearest representable number */
FP_RP=1, /* round to positive infinity */
FP_RM=2, /* round to negative infinity */
FP_RZ=3 /* round to zero (truncate) */
} fp_rnd ;
#elif defined(__m68k__)
typedef enum {
FP_RN=0, /* round to nearest representable number */
FP_RZ=1, /* round to zero (truncate) */
FP_RM=2, /* round to negative infinity */
FP_RP=3 /* round to positive infinity */
} fp_rnd ;
#endif
extern fp_rnd fpgetround __P((void));
extern fp_rnd fpsetround __P((fp_rnd));
extern fp_except fpgetmask __P((void));
extern fp_except fpsetmask __P((fp_except));
extern fp_except fpgetsticky __P((void));
extern fp_except fpsetsticky __P((fp_except));
#endif /* _IEEEFP_H_ */