Bjorn Reese | 4502960 | 2001-08-21 09:23:53 +0000 | [diff] [blame] | 1 | /************************************************************************* |
| 2 | * |
| 3 | * $Id$ |
| 4 | * |
| 5 | * Copyright (C) 2001 Bjorn Reese <breese@users.sourceforge.net> |
| 6 | * |
| 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. |
| 10 | * |
| 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. |
| 15 | * |
| 16 | ************************************************************************/ |
| 17 | |
Bjorn Reese | 026d29f | 2002-01-19 15:40:18 +0000 | [diff] [blame] | 18 | #ifndef TRIO_NAN_H |
| 19 | #define TRIO_NAN_H |
| 20 | |
| 21 | #include "triodef.h" |
Bjorn Reese | 4502960 | 2001-08-21 09:23:53 +0000 | [diff] [blame] | 22 | |
| 23 | #ifdef __cplusplus |
| 24 | extern "C" { |
| 25 | #endif |
Daniel Veillard | 21458c8 | 2002-03-27 16:12:22 +0000 | [diff] [blame] | 26 | |
| 27 | enum { |
| 28 | TRIO_FP_INFINITE, |
| 29 | TRIO_FP_NAN, |
| 30 | TRIO_FP_NORMAL, |
| 31 | TRIO_FP_SUBNORMAL, |
| 32 | TRIO_FP_ZERO |
| 33 | }; |
| 34 | |
Bjorn Reese | 4502960 | 2001-08-21 09:23:53 +0000 | [diff] [blame] | 35 | /* |
| 36 | * Return NaN (Not-a-Number). |
| 37 | */ |
Daniel Veillard | b7c29c3 | 2002-09-25 22:44:43 +0000 | [diff] [blame] | 38 | TRIO_PUBLIC double trio_nan TRIO_PROTO((void)); |
Bjorn Reese | 4502960 | 2001-08-21 09:23:53 +0000 | [diff] [blame] | 39 | |
| 40 | /* |
| 41 | * Return positive infinity. |
| 42 | */ |
Daniel Veillard | b7c29c3 | 2002-09-25 22:44:43 +0000 | [diff] [blame] | 43 | TRIO_PUBLIC double trio_pinf TRIO_PROTO((void)); |
Bjorn Reese | 4502960 | 2001-08-21 09:23:53 +0000 | [diff] [blame] | 44 | |
| 45 | /* |
| 46 | * Return negative infinity. |
| 47 | */ |
Daniel Veillard | b7c29c3 | 2002-09-25 22:44:43 +0000 | [diff] [blame] | 48 | TRIO_PUBLIC double trio_ninf TRIO_PROTO((void)); |
Daniel Veillard | f8e3db0 | 2012-09-11 13:26:36 +0800 | [diff] [blame] | 49 | |
Bjorn Reese | 4502960 | 2001-08-21 09:23:53 +0000 | [diff] [blame] | 50 | /* |
Daniel Veillard | b7c29c3 | 2002-09-25 22:44:43 +0000 | [diff] [blame] | 51 | * Return negative zero. |
| 52 | */ |
| 53 | TRIO_PUBLIC double trio_nzero TRIO_PROTO((TRIO_NOARGS)); |
| 54 | |
| 55 | /* |
Bjorn Reese | 4502960 | 2001-08-21 09:23:53 +0000 | [diff] [blame] | 56 | * If number is a NaN return non-zero, otherwise return zero. |
| 57 | */ |
Daniel Veillard | b7c29c3 | 2002-09-25 22:44:43 +0000 | [diff] [blame] | 58 | TRIO_PUBLIC int trio_isnan TRIO_PROTO((double number)); |
Bjorn Reese | 4502960 | 2001-08-21 09:23:53 +0000 | [diff] [blame] | 59 | |
| 60 | /* |
| 61 | * If number is positive infinity return 1, if number is negative |
| 62 | * infinity return -1, otherwise return 0. |
| 63 | */ |
Daniel Veillard | b7c29c3 | 2002-09-25 22:44:43 +0000 | [diff] [blame] | 64 | TRIO_PUBLIC int trio_isinf TRIO_PROTO((double number)); |
Bjorn Reese | 4502960 | 2001-08-21 09:23:53 +0000 | [diff] [blame] | 65 | |
Daniel Veillard | 21458c8 | 2002-03-27 16:12:22 +0000 | [diff] [blame] | 66 | /* |
| 67 | * If number is finite return non-zero, otherwise return zero. |
| 68 | */ |
William M. Brack | a71a8ef | 2003-08-06 04:43:55 +0000 | [diff] [blame] | 69 | #if 0 |
| 70 | /* Temporary fix - these 2 routines not used in libxml */ |
Daniel Veillard | b7c29c3 | 2002-09-25 22:44:43 +0000 | [diff] [blame] | 71 | TRIO_PUBLIC int trio_isfinite TRIO_PROTO((double number)); |
Daniel Veillard | 21458c8 | 2002-03-27 16:12:22 +0000 | [diff] [blame] | 72 | |
Daniel Veillard | b7c29c3 | 2002-09-25 22:44:43 +0000 | [diff] [blame] | 73 | TRIO_PUBLIC int trio_fpclassify TRIO_PROTO((double number)); |
William M. Brack | a71a8ef | 2003-08-06 04:43:55 +0000 | [diff] [blame] | 74 | #endif |
| 75 | |
| 76 | TRIO_PUBLIC int trio_signbit TRIO_PROTO((double number)); |
Daniel Veillard | 21458c8 | 2002-03-27 16:12:22 +0000 | [diff] [blame] | 77 | |
Daniel Veillard | b7c29c3 | 2002-09-25 22:44:43 +0000 | [diff] [blame] | 78 | TRIO_PUBLIC int trio_fpclassify_and_signbit TRIO_PROTO((double number, int *is_negative)); |
Daniel Veillard | 21458c8 | 2002-03-27 16:12:22 +0000 | [diff] [blame] | 79 | |
Bjorn Reese | 4502960 | 2001-08-21 09:23:53 +0000 | [diff] [blame] | 80 | #ifdef __cplusplus |
| 81 | } |
| 82 | #endif |
| 83 | |
Bjorn Reese | 026d29f | 2002-01-19 15:40:18 +0000 | [diff] [blame] | 84 | #endif /* TRIO_NAN_H */ |