xref: /haiku/src/system/libroot/posix/glibc/math/math.h (revision 3af8011358bd4c624a0979336d48dabb466171ed)
1 /* The GNU C Library is free software; you can redistribute it and/or
2    modify it under the terms of the GNU Lesser General Public
3    License as published by the Free Software Foundation; either
4    version 2.1 of the License, or (at your option) any later version.
5 
6    The GNU C Library is distributed in the hope that it will be useful,
7    but WITHOUT ANY WARRANTY; without even the implied warranty of
8    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
9    Lesser General Public License for more details.
10 
11    You should have received a copy of the GNU Lesser General Public
12    License along with the GNU C Library; if not, write to the Free
13    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
14    02111-1307 USA.  */
15 
16 #ifndef	_MATH_H
17 #define	_MATH_H	1
18 
19 #include_next <math.h>
20 
21 #include <features.h>
22 
23 #if __GNUC__ == 2
24 #define __HUGE_VALL_bytes	{ 0, 0, 0, 0, 0, 0, 0, 0x80, 0xff, 0x7f, 0, 0 }
25 
26 #define __huge_vall_t	union { unsigned char __c[12]; long double __ld; }
27 #define HUGE_VALL	(__extension__ \
28 			 ((__huge_vall_t) { __c: __HUGE_VALL_bytes }).__ld)
29 #endif
30 
31 /* The above constants are not adequate for computation using `long double's.
32    Therefore we provide as an extension constants with similar names as a
33    GNU extension.  Provide enough digits for the 128-bit IEEE quad.  */
34 # define M_El		2.7182818284590452353602874713526625L  /* e */
35 # define M_LOG2El	1.4426950408889634073599246810018921L  /* log_2 e */
36 # define M_LOG10El	0.4342944819032518276511289189166051L  /* log_10 e */
37 # define M_LN2l		0.6931471805599453094172321214581766L  /* log_e 2 */
38 # define M_LN10l	2.3025850929940456840179914546843642L  /* log_e 10 */
39 # define M_PIl		3.1415926535897932384626433832795029L  /* pi */
40 # define M_PI_2l	1.5707963267948966192313216916397514L  /* pi/2 */
41 # define M_PI_4l	0.7853981633974483096156608458198757L  /* pi/4 */
42 # define M_1_PIl	0.3183098861837906715377675267450287L  /* 1/pi */
43 # define M_2_PIl	0.6366197723675813430755350534900574L  /* 2/pi */
44 # define M_2_SQRTPIl	1.1283791670955125738961589031215452L  /* 2/sqrt(pi) */
45 # define M_SQRT2l	1.4142135623730950488016887242096981L  /* sqrt(2) */
46 # define M_SQRT1_2l	0.7071067811865475244008443621048490L  /* 1/sqrt(2) */
47 
48 extern void sincos(double x, double *sin, double *cos);
49 extern void sincosf(float x, float *sin, float *cos);
50 extern void sincosl(long double x, long double *sin, long double *cos);
51 
52 #endif /* math.h  */
53