1 /* generic_math_int64.h - Native methods for 64bit math operations
2    Copyright (C) 1998 Free Software Foundation, Inc.
3 
4 This file is part of GNU Classpath.
5 
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10 
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING.  If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301 USA.
20 
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library.  Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
25 
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module.  An independent module is a module which is not derived from
33 or based on this library.  If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so.  If you do not wish to do so, delete this
36 exception statement from your version. */
37 
38 /*
39 Description: generic target defintions of float/double constants/
40              macros/functions
41 Systems    : all
42 */
43 
44 #ifndef __TARGET_GENERIC_MATH_FLOAT__
45 #define __TARGET_GENERIC_MATH_FLOAT__
46 
47 /* check if target_native_math_float.h included */
48 #ifndef __TARGET_NATIVE_MATH_FLOAT__
49   #error Do NOT INCLUDE generic target files! Include the corresponding native target files instead!
50 #endif
51 
52 /****************************** Includes *******************************/
53 /* do not move; needed here because of some macro definitions */
54 #include "config.h"
55 
56 #include <stdlib.h>
57 #include <assert.h>
58 
59 #include <jni.h>
60 
61 /****************** Conditional compilation switches *******************/
62 
63 /***************************** Constants *******************************/
64 
65 /***************************** Datatypes *******************************/
66 
67 /***************************** Variables *******************************/
68 
69 /****************************** Macros *********************************/
70 
71 /* test float/double values for NaN,Inf */
72 #ifndef TARGET_NATIVE_MATH_FLOAT_FLOAT_ISNAN
73   #include <math.h>
74   #define TARGET_NATIVE_MATH_FLOAT_FLOAT_ISNAN(f) isnan(f)
75 #endif
76 #ifndef TARGET_NATIVE_MATH_FLOAT_FLOAT_ISINF
77   #include <math.h>
78   #define TARGET_NATIVE_MATH_FLOAT_FLOAT_ISINF(f) isinf(f)
79 #endif
80 #ifndef TARGET_NATIVE_MATH_FLOAT_FLOAT_FINITE
81   #include <math.h>
82   #define TARGET_NATIVE_MATH_FLOAT_FLOAT_FINITE(f) finite(f)
83 #endif
84 
85 #ifndef TARGET_NATIVE_MATH_FLOAT_DOUBLE_ISNAN
86   #include <math.h>
87   #define TARGET_NATIVE_MATH_FLOAT_DOUBLE_ISNAN(d) isnan(d)
88 #endif
89 #ifndef TARGET_NATIVE_MATH_FLOAT_DOUBLE_ISINF
90   #include <math.h>
91   #define TARGET_NATIVE_MATH_FLOAT_DOUBLE_ISINF(d) isinf(d)
92 #endif
93 #ifndef TARGET_NATIVE_MATH_FLOAT_DOUBLE_FINITE
94   #include <math.h>
95   #define TARGET_NATIVE_MATH_FLOAT_DOUBLE_FINITE(d) finite(d)
96 #endif
97 
98 /* division, modulo operations (used to avoid unexcepted exceptions on some
99    targets; generic codes are direct operations without checks)
100 */
101 #ifndef TARGET_NATIVE_MATH_FLOAT_FLOAT_DIV
102   #define TARGET_NATIVE_MATH_FLOAT_FLOAT_DIV(f0,f1) ((f0)/(f1))
103 #endif
104 #ifndef TARGET_NATIVE_MATH_FLOAT_FLOAT_MOD
105   #include <math.h>
106   #define TARGET_NATIVE_MATH_FLOAT_FLOAT_MOD(f0,f1) ((jfloat)fmod((jdouble)(f0),(jdouble)(f1)))
107 #endif
108 
109 #ifndef TARGET_NATIVE_MATH_FLOAT_DOUBLE_DIV
110   #define TARGET_NATIVE_MATH_FLOAT_DOUBLE_DIV(d0,d1) ((d0)/(d1))
111 #endif
112 #ifndef TARGET_NATIVE_MATH_FLOAT_DOUBLE_MOD
113   #include <math.h>
114   #define TARGET_NATIVE_MATH_FLOAT_DOUBLE_MOD(d0,d1) fmod(d0,d1)
115 #endif
116 
117 /***************************** Functions *******************************/
118 
119 #ifdef __cplusplus
120 extern "C"
121 #endif
122 
123 #ifdef __cplusplus
124 }
125 #endif
126 
127 #endif /* __TARGET_GENERIC_MATH_FLOAT__ */
128 
129 /* end of file */
130 
131