math_private.h (84662) | math_private.h (87805) |
---|---|
1/* 2 * ==================================================== 3 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 4 * 5 * Developed at SunPro, a Sun Microsystems, Inc. business. 6 * Permission to use, copy, modify, and distribute this 7 * software is freely granted, provided that this notice 8 * is preserved. 9 * ==================================================== 10 */ 11 12/* 13 * from: @(#)fdlibm.h 5.1 93/09/24 | 1/* 2 * ==================================================== 3 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 4 * 5 * Developed at SunPro, a Sun Microsystems, Inc. business. 6 * Permission to use, copy, modify, and distribute this 7 * software is freely granted, provided that this notice 8 * is preserved. 9 * ==================================================== 10 */ 11 12/* 13 * from: @(#)fdlibm.h 5.1 93/09/24 |
14 * $FreeBSD: head/lib/msun/src/math_private.h 84662 2001-10-08 08:29:52Z dfr $ | 14 * $FreeBSD: head/lib/msun/src/math_private.h 87805 2001-12-13 17:22:17Z phantom $ |
15 */ 16 17#ifndef _MATH_PRIVATE_H_ | 15 */ 16 17#ifndef _MATH_PRIVATE_H_ |
18#define _MATH_PRIVATE_H_ | 18#define _MATH_PRIVATE_H_ |
19 20#include <sys/types.h> 21#include <machine/endian.h> 22 | 19 20#include <sys/types.h> 21#include <machine/endian.h> 22 |
23/* The original fdlibm code used statements like: 24 n0 = ((*(int*)&one)>>29)^1; * index of high word * 25 ix0 = *(n0+(int*)&x); * high word of x * 26 ix1 = *((1-n0)+(int*)&x); * low word of x * 27 to dig two 32 bit words out of the 64 bit IEEE floating point 28 value. That is non-ANSI, and, moreover, the gcc instruction 29 scheduler gets it wrong. We instead use the following macros. 30 Unlike the original code, we determine the endianness at compile 31 time, not at run time; I don't see much benefit to selecting 32 endianness at run time. */ | 23/* 24 * The original fdlibm code used statements like: 25 * n0 = ((*(int*)&one)>>29)^1; * index of high word * 26 * ix0 = *(n0+(int*)&x); * high word of x * 27 * ix1 = *((1-n0)+(int*)&x); * low word of x * 28 * to dig two 32 bit words out of the 64 bit IEEE floating point 29 * value. That is non-ANSI, and, moreover, the gcc instruction 30 * scheduler gets it wrong. We instead use the following macros. 31 * Unlike the original code, we determine the endianness at compile 32 * time, not at run time; I don't see much benefit to selecting 33 * endianness at run time. 34 */ |
33 | 35 |
34/* A union which permits us to convert between a double and two 32 bit 35 ints. */ | 36/* 37 * A union which permits us to convert between a double and two 32 bit 38 * ints. 39 */ |
36 37#if BYTE_ORDER == BIG_ENDIAN 38 39typedef union 40{ 41 double value; 42 struct 43 { --- 71 unchanged lines hidden (view full) --- 115#define SET_LOW_WORD(d,v) \ 116do { \ 117 ieee_double_shape_type sl_u; \ 118 sl_u.value = (d); \ 119 sl_u.parts.lsw = (v); \ 120 (d) = sl_u.value; \ 121} while (0) 122 | 40 41#if BYTE_ORDER == BIG_ENDIAN 42 43typedef union 44{ 45 double value; 46 struct 47 { --- 71 unchanged lines hidden (view full) --- 119#define SET_LOW_WORD(d,v) \ 120do { \ 121 ieee_double_shape_type sl_u; \ 122 sl_u.value = (d); \ 123 sl_u.parts.lsw = (v); \ 124 (d) = sl_u.value; \ 125} while (0) 126 |
123/* A union which permits us to convert between a float and a 32 bit 124 int. */ | 127/* 128 * A union which permits us to convert between a float and a 32 bit 129 * int. 130 */ |
125 126typedef union 127{ 128 float value; 129 /* FIXME: Assumes 32 bit int. */ 130 unsigned int word; 131} ieee_float_shape_type; 132 --- 11 unchanged lines hidden (view full) --- 144#define SET_FLOAT_WORD(d,i) \ 145do { \ 146 ieee_float_shape_type sf_u; \ 147 sf_u.word = (i); \ 148 (d) = sf_u.value; \ 149} while (0) 150 151/* ieee style elementary functions */ | 131 132typedef union 133{ 134 float value; 135 /* FIXME: Assumes 32 bit int. */ 136 unsigned int word; 137} ieee_float_shape_type; 138 --- 11 unchanged lines hidden (view full) --- 150#define SET_FLOAT_WORD(d,i) \ 151do { \ 152 ieee_float_shape_type sf_u; \ 153 sf_u.word = (i); \ 154 (d) = sf_u.value; \ 155} while (0) 156 157/* ieee style elementary functions */ |
152extern double __ieee754_sqrt __P((double)); 153extern double __ieee754_acos __P((double)); 154extern double __ieee754_acosh __P((double)); 155extern double __ieee754_log __P((double)); 156extern double __ieee754_atanh __P((double)); 157extern double __ieee754_asin __P((double)); 158extern double __ieee754_atan2 __P((double,double)); 159extern double __ieee754_exp __P((double)); 160extern double __ieee754_cosh __P((double)); 161extern double __ieee754_fmod __P((double,double)); 162extern double __ieee754_pow __P((double,double)); 163extern double __ieee754_lgamma_r __P((double,int *)); 164extern double __ieee754_gamma_r __P((double,int *)); 165extern double __ieee754_lgamma __P((double)); 166extern double __ieee754_gamma __P((double)); 167extern double __ieee754_log10 __P((double)); 168extern double __ieee754_sinh __P((double)); 169extern double __ieee754_hypot __P((double,double)); 170extern double __ieee754_j0 __P((double)); 171extern double __ieee754_j1 __P((double)); 172extern double __ieee754_y0 __P((double)); 173extern double __ieee754_y1 __P((double)); 174extern double __ieee754_jn __P((int,double)); 175extern double __ieee754_yn __P((int,double)); 176extern double __ieee754_remainder __P((double,double)); 177extern int __ieee754_rem_pio2 __P((double,double*)); 178extern double __ieee754_scalb __P((double,double)); | 158double __ieee754_sqrt __P((double)); 159double __ieee754_acos __P((double)); 160double __ieee754_acosh __P((double)); 161double __ieee754_log __P((double)); 162double __ieee754_atanh __P((double)); 163double __ieee754_asin __P((double)); 164double __ieee754_atan2 __P((double,double)); 165double __ieee754_exp __P((double)); 166double __ieee754_cosh __P((double)); 167double __ieee754_fmod __P((double,double)); 168double __ieee754_pow __P((double,double)); 169double __ieee754_lgamma_r __P((double,int *)); 170double __ieee754_gamma_r __P((double,int *)); 171double __ieee754_lgamma __P((double)); 172double __ieee754_gamma __P((double)); 173double __ieee754_log10 __P((double)); 174double __ieee754_sinh __P((double)); 175double __ieee754_hypot __P((double,double)); 176double __ieee754_j0 __P((double)); 177double __ieee754_j1 __P((double)); 178double __ieee754_y0 __P((double)); 179double __ieee754_y1 __P((double)); 180double __ieee754_jn __P((int,double)); 181double __ieee754_yn __P((int,double)); 182double __ieee754_remainder __P((double,double)); 183int __ieee754_rem_pio2 __P((double,double*)); 184double __ieee754_scalb __P((double,double)); |
179 180/* fdlibm kernel function */ | 185 186/* fdlibm kernel function */ |
181extern double __kernel_standard __P((double,double,int)); 182extern double __kernel_sin __P((double,double,int)); 183extern double __kernel_cos __P((double,double)); 184extern double __kernel_tan __P((double,double,int)); 185extern int __kernel_rem_pio2 __P((double*,double*,int,int,int,const int*)); | 187double __kernel_standard __P((double,double,int)); 188double __kernel_sin __P((double,double,int)); 189double __kernel_cos __P((double,double)); 190double __kernel_tan __P((double,double,int)); 191int __kernel_rem_pio2 __P((double*,double*,int,int,int,const int*)); |
186 | 192 |
187 | |
188/* ieee style elementary float functions */ | 193/* ieee style elementary float functions */ |
189extern float __ieee754_sqrtf __P((float)); 190extern float __ieee754_acosf __P((float)); 191extern float __ieee754_acoshf __P((float)); 192extern float __ieee754_logf __P((float)); 193extern float __ieee754_atanhf __P((float)); 194extern float __ieee754_asinf __P((float)); 195extern float __ieee754_atan2f __P((float,float)); 196extern float __ieee754_expf __P((float)); 197extern float __ieee754_coshf __P((float)); 198extern float __ieee754_fmodf __P((float,float)); 199extern float __ieee754_powf __P((float,float)); 200extern float __ieee754_lgammaf_r __P((float,int *)); 201extern float __ieee754_gammaf_r __P((float,int *)); 202extern float __ieee754_lgammaf __P((float)); 203extern float __ieee754_gammaf __P((float)); 204extern float __ieee754_log10f __P((float)); 205extern float __ieee754_sinhf __P((float)); 206extern float __ieee754_hypotf __P((float,float)); 207extern float __ieee754_j0f __P((float)); 208extern float __ieee754_j1f __P((float)); 209extern float __ieee754_y0f __P((float)); 210extern float __ieee754_y1f __P((float)); 211extern float __ieee754_jnf __P((int,float)); 212extern float __ieee754_ynf __P((int,float)); 213extern float __ieee754_remainderf __P((float,float)); 214extern int __ieee754_rem_pio2f __P((float,float*)); 215extern float __ieee754_scalbf __P((float,float)); | 194float __ieee754_sqrtf __P((float)); 195float __ieee754_acosf __P((float)); 196float __ieee754_acoshf __P((float)); 197float __ieee754_logf __P((float)); 198float __ieee754_atanhf __P((float)); 199float __ieee754_asinf __P((float)); 200float __ieee754_atan2f __P((float,float)); 201float __ieee754_expf __P((float)); 202float __ieee754_coshf __P((float)); 203float __ieee754_fmodf __P((float,float)); 204float __ieee754_powf __P((float,float)); 205float __ieee754_lgammaf_r __P((float,int *)); 206float __ieee754_gammaf_r __P((float,int *)); 207float __ieee754_lgammaf __P((float)); 208float __ieee754_gammaf __P((float)); 209float __ieee754_log10f __P((float)); 210float __ieee754_sinhf __P((float)); 211float __ieee754_hypotf __P((float,float)); 212float __ieee754_j0f __P((float)); 213float __ieee754_j1f __P((float)); 214float __ieee754_y0f __P((float)); 215float __ieee754_y1f __P((float)); 216float __ieee754_jnf __P((int,float)); 217float __ieee754_ynf __P((int,float)); 218float __ieee754_remainderf __P((float,float)); 219int __ieee754_rem_pio2f __P((float,float*)); 220float __ieee754_scalbf __P((float,float)); |
216 217/* float versions of fdlibm kernel functions */ | 221 222/* float versions of fdlibm kernel functions */ |
218extern float __kernel_sinf __P((float,float,int)); 219extern float __kernel_cosf __P((float,float)); 220extern float __kernel_tanf __P((float,float,int)); 221extern int __kernel_rem_pio2f __P((float*,float*,int,int,int,const int*)); | 223float __kernel_sinf __P((float,float,int)); 224float __kernel_cosf __P((float,float)); 225float __kernel_tanf __P((float,float,int)); 226int __kernel_rem_pio2f __P((float*,float*,int,int,int,const int*)); |
222 223#if defined(__alpha__) || defined(__ia64__) 224#define __generic___ieee754_acos __ieee754_acos 225#define __generic___ieee754_asin __ieee754_asin 226#define __generic___ieee754_atan2 __ieee754_atan2 227#define __generic___ieee754_exp __ieee754_exp 228#define __generic___ieee754_fmod __ieee754_fmod 229#define __generic___ieee754_log __ieee754_log --- 12 unchanged lines hidden (view full) --- 242#define __generic_logb logb 243#define __generic_rint rint 244#define __generic_scalbn scalbn 245#define __generic_significand significand 246#define __generic_sin sin 247#define __generic_tan tan 248#endif 249 | 227 228#if defined(__alpha__) || defined(__ia64__) 229#define __generic___ieee754_acos __ieee754_acos 230#define __generic___ieee754_asin __ieee754_asin 231#define __generic___ieee754_atan2 __ieee754_atan2 232#define __generic___ieee754_exp __ieee754_exp 233#define __generic___ieee754_fmod __ieee754_fmod 234#define __generic___ieee754_log __ieee754_log --- 12 unchanged lines hidden (view full) --- 247#define __generic_logb logb 248#define __generic_rint rint 249#define __generic_scalbn scalbn 250#define __generic_significand significand 251#define __generic_sin sin 252#define __generic_tan tan 253#endif 254 |
250#endif /* _MATH_PRIVATE_H_ */ | 255#endif /* !_MATH_PRIVATE_H_ */ |