mirror of
https://github.com/Interlisp/maiko.git
synced 2026-02-14 19:56:28 +00:00
* Include <ieeefp.h> for Solaris. * Remove sections for sparc and Sun i386 for non-Solaris. * Have Linux use the same code as FreeBSD and macOS. * Make the FreeBSD / Linux / macOS code path the default, if nothing special is defined since it is the modern way. * Remove fpstatus_() usage from the ancient days.
55 lines
1.6 KiB
C
Executable File
55 lines
1.6 KiB
C
Executable File
/* $Id: medleyfp.h,v 1.2 1999/01/03 02:06:16 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
|
|
|
|
|
|
/************************************************************************/
|
|
/* */
|
|
/* (C) Copyright 1989-94 Venue. All Rights Reserved. */
|
|
/* Manufactured in the United States of America. */
|
|
/* */
|
|
/************************************************************************/
|
|
|
|
/************************************************************************/
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/************************************************************************/
|
|
|
|
/* --------------------------------------------------
|
|
FPCLEAR - clear status as necessary
|
|
FPTEST(result) - check result or status
|
|
|
|
Sun 4 compiler w. -O2 moves too much code around
|
|
to use FLTINT.
|
|
-------------------------------------------------- */
|
|
|
|
#ifdef FLTINT
|
|
volatile extern int FP_error;
|
|
|
|
/* Note that a compiler may very likely move code around the arithmetic
|
|
operation, causing this test (set by an interrupt handler) to be
|
|
incorrect. For example, the Sun SPARC compiler with -O2 makes
|
|
this test incorrect.
|
|
*/
|
|
|
|
#define FPCLEAR FP_error = 0;
|
|
#define FPTEST(result) FP_error
|
|
|
|
#elif defined(OS5)
|
|
#include <ieeefp.h>
|
|
#define FPCLEAR
|
|
#define FPTEST(result) (!finite(result))
|
|
|
|
#elif defined(DOS)
|
|
#include <i32.h>
|
|
#define FPCLEAR
|
|
#define FPTEST(result) (_getrealerror() & ( I87_ZERO_DIVIDE | I87_OVERFLOW | I87_UNDERFLOW))
|
|
|
|
#else
|
|
#include <math.h>
|
|
#define FPCLEAR
|
|
#define FPTEST(result) (!isfinite(result))
|
|
|
|
#endif /* FLTINT */
|