1 /*************************************************************************
3 * $Id: trionan.h,v 1.9 2005/03/27 18:52:45 breese Exp $
5 * Copyright (C) 2001 Bjorn Reese <breese@users.sourceforge.net>
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
11 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
12 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
13 * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
14 * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
16 ************************************************************************/
18 #ifndef TRIO_TRIONAN_H
19 #define TRIO_TRIONAN_H
27 #if !defined(TRIO_PUBLIC_NAN)
28 # if !defined(TRIO_PUBLIC)
31 # define TRIO_PUBLIC_NAN TRIO_PUBLIC
42 /*************************************************************************
46 #if defined(TRIO_EMBED_NAN)
49 * The application that trionan is embedded in must define which functions
52 * The following resolves internal dependencies.
55 # if defined(TRIO_FUNC_ISNAN) \
56 || defined(TRIO_FUNC_ISINF)
57 # if !defined(TRIO_FUNC_FPCLASSIFY_AND_SIGNBIT)
58 # define TRIO_FUNC_FPCLASSIFY_AND_SIGNBIT
62 # if defined(TRIO_FUNC_NAN)
63 # if !defined(TRIO_FUNC_PINF)
64 # define TRIO_FUNC_PINF
68 # if defined(TRIO_FUNC_NINF)
69 # if !defined(TRIO_FUNC_PINF)
70 # define TRIO_FUNC_PINF
77 * When trionan is not embedded all all functions are defined.
80 # define TRIO_FUNC_NAN
81 # define TRIO_FUNC_PINF
82 # define TRIO_FUNC_NINF
83 # define TRIO_FUNC_NZERO
84 # define TRIO_FUNC_ISNAN
85 # define TRIO_FUNC_ISINF
86 # define TRIO_FUNC_ISFINITE
87 # define TRIO_FUNC_SIGNBIT
88 # define TRIO_FUNC_FPCLASSIFY
89 # define TRIO_FUNC_FPCLASSIFY_AND_SIGNBIT
93 /*************************************************************************
98 * Return NaN (Not-a-Number).
100 #if defined(TRIO_FUNC_NAN)
101 TRIO_PUBLIC_NAN double
107 * Return positive infinity.
109 #if defined(TRIO_FUNC_PINF)
110 TRIO_PUBLIC_NAN double
116 * Return negative infinity.
118 #if defined(TRIO_FUNC_NINF)
119 TRIO_PUBLIC_NAN double
125 * Return negative zero.
127 #if defined(TRIO_FUNC_NZERO)
128 TRIO_PUBLIC_NAN double
130 TRIO_PROTO((TRIO_NOARGS));
134 * If number is a NaN return non-zero, otherwise return zero.
136 #if defined(TRIO_FUNC_ISNAN)
139 TRIO_PROTO((double number));
143 * If number is positive infinity return 1, if number is negative
144 * infinity return -1, otherwise return 0.
146 #if defined(TRIO_FUNC_ISINF)
149 TRIO_PROTO((double number));
153 * If number is finite return non-zero, otherwise return zero.
155 #if defined(TRIO_FUNC_ISFINITE)
158 TRIO_PROTO((double number));
161 #if defined(TRIO_FUNC_SIGNBIT)
164 TRIO_PROTO((double number));
167 #if defined(TRIO_FUNC_FPCLASSIFY)
170 TRIO_PROTO((double number));
173 #if defined(TRIO_FUNC_FPCLASSIFY_AND_SIGNBIT)
175 trio_fpclassify_and_signbit
176 TRIO_PROTO((double number, int *is_negative));
183 #endif /* TRIO_TRIONAN_H */