VirtualBox

source: vbox/trunk/include/iprt/nocrt/math.h@ 96019

Last change on this file since 96019 was 96019, checked in by vboxsync, 3 years ago

include/iprt/nocrt: Header build fixes for linux. bugref:10261

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 27.6 KB
Line 
1/** @file
2 * IPRT / No-CRT - math.h.
3 */
4
5/*
6 * Copyright (C) 2006-2022 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 * --------------------------------------------------------------------
25 *
26 * This code is based on:
27 *
28 * from: @(#)fdlibm.h 5.1 93/09/24
29 * $FreeBSD: src/lib/msun/src/math.h,v 1.61 2005/04/16 21:12:47 das Exp $
30 * FreeBSD HEAD 2005-06-xx
31 *
32 * ====================================================
33 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
34 *
35 * Developed at SunPro, a Sun Microsystems, Inc. business.
36 * Permission to use, copy, modify, and distribute this
37 * software is freely granted, provided that this notice
38 * is preserved.
39 * ====================================================
40 */
41
42#ifndef IPRT_INCLUDED_nocrt_math_h
43#define IPRT_INCLUDED_nocrt_math_h
44#ifndef RT_WITHOUT_PRAGMA_ONCE
45# pragma once
46#endif
47
48#include <iprt/types.h>
49/*#include <machine/_limits.h>*/
50
51/* from sys/cdefs.h */
52#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
53#define __GNUC_PREREQ__(ma, mi) \
54 (__GNUC__ > (ma) || __GNUC__ == (ma) && __GNUC_MINOR__ >= (mi))
55#else
56#define __GNUC_PREREQ__(ma, mi) 0
57#endif
58#undef __pure2 /* darwin: avoid conflict with system headers when doing syntax checking of the headers */
59#define __pure2
60
61
62/*
63 * ANSI/POSIX
64 */
65extern const union __infinity_un {
66 unsigned char __uc[8];
67 double __ud;
68} RT_NOCRT(__infinity);
69
70extern const union __nan_un {
71 unsigned char __uc[sizeof(float)];
72 float __uf;
73} RT_NOCRT(__nan);
74
75#if __GNUC_PREREQ__(3, 3) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800)
76#define __MATH_BUILTIN_CONSTANTS
77#endif
78
79#if __GNUC_PREREQ__(3, 0) && !defined(__INTEL_COMPILER)
80#define __MATH_BUILTIN_RELOPS
81#endif
82
83#ifdef __MATH_BUILTIN_CONSTANTS
84#define HUGE_VAL __builtin_huge_val()
85#else
86#define HUGE_VAL (RT_NOCRT(__infinity).__ud)
87#endif
88
89/*
90 * XOPEN/SVID
91 */
92#if 1/* __BSD_VISIBLE || __XSI_VISIBLE*/
93#define M_E 2.7182818284590452354 /* e */
94#define M_LOG2E 1.4426950408889634074 /* log 2e */
95#define M_LOG10E 0.43429448190325182765 /* log 10e */
96#define M_LN2 0.69314718055994530942 /* log e2 */
97#define M_LN10 2.30258509299404568402 /* log e10 */
98#define M_PI 3.14159265358979323846 /* pi */
99#define M_PI_2 1.57079632679489661923 /* pi/2 */
100#define M_PI_4 0.78539816339744830962 /* pi/4 */
101#define M_1_PI 0.31830988618379067154 /* 1/pi */
102#define M_2_PI 0.63661977236758134308 /* 2/pi */
103#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
104#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
105#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
106
107#define MAXFLOAT ((float)3.40282346638528860e+38)
108extern int RT_NOCRT(signgam);
109#endif /* __BSD_VISIBLE || __XSI_VISIBLE */
110
111#if 1/* __BSD_VISIBLE*/
112#if 0
113/* Old value from 4.4BSD-Lite math.h; this is probably better. */
114#define HUGE HUGE_VAL
115#else
116#define HUGE MAXFLOAT
117#endif
118#endif /* __BSD_VISIBLE */
119
120/*
121 * Most of these functions depend on the rounding mode and have the side
122 * effect of raising floating-point exceptions, so they are not declared
123 * as __pure2. In C99, FENV_ACCESS affects the purity of these functions.
124 */
125RT_C_DECLS_BEGIN
126/*
127 * ANSI/POSIX
128 */
129int RT_NOCRT(__fpclassifyd)(double) __pure2;
130int RT_NOCRT(__fpclassifyf)(float) __pure2;
131int RT_NOCRT(__fpclassifyl)(long double) __pure2;
132int RT_NOCRT(__isfinitef)(float) __pure2;
133int RT_NOCRT(__isfinite)(double) __pure2;
134int RT_NOCRT(__isfinitel)(long double) __pure2;
135int RT_NOCRT(__isinff)(float) __pure2;
136int RT_NOCRT(__isinfl)(long double) __pure2;
137int RT_NOCRT(__isnanl)(long double) __pure2;
138int RT_NOCRT(__isnormalf)(float) __pure2;
139int RT_NOCRT(__isnormal)(double) __pure2;
140int RT_NOCRT(__isnormall)(long double) __pure2;
141int RT_NOCRT(__signbit)(double) __pure2;
142int RT_NOCRT(__signbitf)(float) __pure2;
143int RT_NOCRT(__signbitl)(long double) __pure2;
144
145double RT_NOCRT(acos)(double);
146double RT_NOCRT(asin)(double);
147double RT_NOCRT(atan)(double);
148double RT_NOCRT(atan2)(double, double);
149double RT_NOCRT(cos)(double);
150double RT_NOCRT(sin)(double);
151double RT_NOCRT(tan)(double);
152
153double RT_NOCRT(cosh)(double);
154double RT_NOCRT(sinh)(double);
155double RT_NOCRT(tanh)(double);
156
157double RT_NOCRT(exp)(double);
158double RT_NOCRT(frexp)(double, int *); /* fundamentally !__pure2 */
159double RT_NOCRT(ldexp)(double, int);
160double RT_NOCRT(log)(double);
161double RT_NOCRT(log10)(double);
162double RT_NOCRT(modf)(double, double *); /* fundamentally !__pure2 */
163
164double RT_NOCRT(pow)(double, double);
165double RT_NOCRT(sqrt)(double);
166
167double RT_NOCRT(ceil)(double);
168double RT_NOCRT(fabs)(double) __pure2;
169double RT_NOCRT(floor)(double);
170double RT_NOCRT(fmod)(double, double);
171
172/*
173 * These functions are not in C90.
174 */
175#if 1 /*__BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE*/
176double RT_NOCRT(acosh)(double);
177double RT_NOCRT(asinh)(double);
178double RT_NOCRT(atanh)(double);
179double RT_NOCRT(cbrt)(double);
180double RT_NOCRT(erf)(double);
181double RT_NOCRT(erfc)(double);
182double RT_NOCRT(exp2)(double);
183double RT_NOCRT(expm1)(double);
184double RT_NOCRT(fma)(double, double, double);
185double RT_NOCRT(hypot)(double, double);
186int RT_NOCRT(ilogb)(double) __pure2;
187int RT_NOCRT(isinf)(double) __pure2;
188int RT_NOCRT(isnan)(double) __pure2;
189double RT_NOCRT(lgamma)(double);
190long long RT_NOCRT(llrint)(double);
191long long RT_NOCRT(llround)(double);
192double RT_NOCRT(log1p)(double);
193double RT_NOCRT(logb)(double);
194long RT_NOCRT(lrint)(double);
195long RT_NOCRT(lround)(double);
196double RT_NOCRT(nextafter)(double, double);
197double RT_NOCRT(remainder)(double, double);
198double RT_NOCRT(remquo)(double, double, int *);
199double RT_NOCRT(rint)(double);
200#endif /* __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE */
201
202#if 1/* __BSD_VISIBLE || __XSI_VISIBLE*/
203double RT_NOCRT(j0)(double);
204double RT_NOCRT(j1)(double);
205double RT_NOCRT(jn)(int, double);
206double RT_NOCRT(scalb)(double, double);
207double RT_NOCRT(y0)(double);
208double RT_NOCRT(y1)(double);
209double RT_NOCRT(yn)(int, double);
210
211#if 1/* __XSI_VISIBLE <= 500 || __BSD_VISIBLE*/
212double RT_NOCRT(gamma)(double);
213#endif
214#endif /* __BSD_VISIBLE || __XSI_VISIBLE */
215
216#if 1/* __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999*/
217double RT_NOCRT(copysign)(double, double) __pure2;
218double RT_NOCRT(fdim)(double, double);
219double RT_NOCRT(fmax)(double, double) __pure2;
220double RT_NOCRT(fmin)(double, double) __pure2;
221double RT_NOCRT(nearbyint)(double);
222double RT_NOCRT(round)(double);
223double RT_NOCRT(scalbln)(double, long);
224double RT_NOCRT(scalbn)(double, int);
225double RT_NOCRT(tgamma)(double);
226double RT_NOCRT(trunc)(double);
227#endif
228
229/*
230 * BSD math library entry points
231 */
232#if 1/* __BSD_VISIBLE*/
233double RT_NOCRT(drem)(double, double);
234int RT_NOCRT(finite)(double) __pure2;
235int RT_NOCRT(isnanf)(float) __pure2;
236
237/*
238 * Reentrant version of gamma & lgamma; passes signgam back by reference
239 * as the second argument; user must allocate space for signgam.
240 */
241double RT_NOCRT(gamma_r)(double, int *);
242double RT_NOCRT(lgamma_r)(double, int *);
243
244/*
245 * IEEE Test Vector
246 */
247double RT_NOCRT(significand)(double);
248#endif /* __BSD_VISIBLE */
249
250/* float versions of ANSI/POSIX functions */
251#if 1/* __ISO_C_VISIBLE >= 1999*/
252float RT_NOCRT(acosf)(float);
253float RT_NOCRT(asinf)(float);
254float RT_NOCRT(atanf)(float);
255float RT_NOCRT(atan2f)(float, float);
256float RT_NOCRT(cosf)(float);
257float RT_NOCRT(sinf)(float);
258float RT_NOCRT(tanf)(float);
259
260float RT_NOCRT(coshf)(float);
261float RT_NOCRT(sinhf)(float);
262float RT_NOCRT(tanhf)(float);
263
264float RT_NOCRT(exp2f)(float);
265float RT_NOCRT(expf)(float);
266float RT_NOCRT(expm1f)(float);
267float RT_NOCRT(frexpf)(float, int *); /* fundamentally !__pure2 */
268int RT_NOCRT(ilogbf)(float) __pure2;
269float RT_NOCRT(ldexpf)(float, int);
270float RT_NOCRT(log10f)(float);
271float RT_NOCRT(log1pf)(float);
272float RT_NOCRT(logf)(float);
273float RT_NOCRT(modff)(float, float *); /* fundamentally !__pure2 */
274
275float RT_NOCRT(powf)(float, float);
276float RT_NOCRT(sqrtf)(float);
277
278float RT_NOCRT(ceilf)(float);
279float RT_NOCRT(fabsf)(float) __pure2;
280float RT_NOCRT(floorf)(float);
281float RT_NOCRT(fmodf)(float, float);
282float RT_NOCRT(roundf)(float);
283
284float RT_NOCRT(erff)(float);
285float RT_NOCRT(erfcf)(float);
286float RT_NOCRT(hypotf)(float, float);
287float RT_NOCRT(lgammaf)(float);
288
289float RT_NOCRT(acoshf)(float);
290float RT_NOCRT(asinhf)(float);
291float RT_NOCRT(atanhf)(float);
292float RT_NOCRT(cbrtf)(float);
293float RT_NOCRT(logbf)(float);
294float RT_NOCRT(copysignf)(float, float) __pure2;
295long long RT_NOCRT(llrintf)(float);
296long long RT_NOCRT(llroundf)(float);
297long RT_NOCRT(lrintf)(float);
298long RT_NOCRT(lroundf)(float);
299float RT_NOCRT(nearbyintf)(float);
300float RT_NOCRT(nextafterf)(float, float);
301float RT_NOCRT(remainderf)(float, float);
302float RT_NOCRT(remquof)(float, float, int *);
303float RT_NOCRT(rintf)(float);
304float RT_NOCRT(scalblnf)(float, long);
305float RT_NOCRT(scalbnf)(float, int);
306float RT_NOCRT(truncf)(float);
307
308float RT_NOCRT(fdimf)(float, float);
309float RT_NOCRT(fmaf)(float, float, float);
310float RT_NOCRT(fmaxf)(float, float) __pure2;
311float RT_NOCRT(fminf)(float, float) __pure2;
312#endif
313
314/*
315 * float versions of BSD math library entry points
316 */
317#if 1/* __BSD_VISIBLE*/
318float RT_NOCRT(dremf)(float, float);
319int RT_NOCRT(finitef)(float) __pure2;
320float RT_NOCRT(gammaf)(float);
321float RT_NOCRT(j0f)(float);
322float RT_NOCRT(j1f)(float);
323float RT_NOCRT(jnf)(int, float);
324float RT_NOCRT(scalbf)(float, float);
325float RT_NOCRT(y0f)(float);
326float RT_NOCRT(y1f)(float);
327float RT_NOCRT(ynf)(int, float);
328
329/*
330 * Float versions of reentrant version of gamma & lgamma; passes
331 * signgam back by reference as the second argument; user must
332 * allocate space for signgam.
333 */
334float RT_NOCRT(gammaf_r)(float, int *);
335float RT_NOCRT(lgammaf_r)(float, int *);
336
337/*
338 * float version of IEEE Test Vector
339 */
340float RT_NOCRT(significandf)(float);
341#endif /* __BSD_VISIBLE */
342
343/*
344 * long double versions of ISO/POSIX math functions
345 */
346#if 1/* __ISO_C_VISIBLE >= 1999*/
347#if 1 /* bird: we've got these */
348long double RT_NOCRT(acoshl)(long double);
349long double RT_NOCRT(acosl)(long double);
350long double RT_NOCRT(asinhl)(long double);
351long double RT_NOCRT(asinl)(long double);
352long double RT_NOCRT(atan2l)(long double, long double);
353long double RT_NOCRT(atanhl)(long double);
354long double RT_NOCRT(atanl)(long double);
355long double RT_NOCRT(cbrtl)(long double);
356#endif
357long double RT_NOCRT(ceill)(long double);
358long double RT_NOCRT(copysignl)(long double, long double) __pure2;
359#if 1 /* bird */
360long double RT_NOCRT(coshl)(long double);
361long double RT_NOCRT(cosl)(long double);
362long double RT_NOCRT(erfcl)(long double);
363long double RT_NOCRT(erfl)(long double);
364long double RT_NOCRT(exp2l)(long double);
365long double RT_NOCRT(expl)(long double);
366long double RT_NOCRT(expm1l)(long double);
367#endif
368long double RT_NOCRT(fabsl)(long double) __pure2;
369long double RT_NOCRT(fdiml)(long double, long double);
370long double RT_NOCRT(floorl)(long double);
371long double RT_NOCRT(fmal)(long double, long double, long double);
372long double RT_NOCRT(fmaxl)(long double, long double) __pure2;
373long double RT_NOCRT(fminl)(long double, long double) __pure2;
374#if 1 /* bird */
375long double RT_NOCRT(fmodl)(long double, long double);
376#endif
377long double RT_NOCRT(frexpl)(long double value, int *); /* fundamentally !__pure2 */
378#if 1 /* bird */
379long double RT_NOCRT(hypotl)(long double, long double);
380#endif
381int RT_NOCRT(ilogbl)(long double) __pure2;
382long double RT_NOCRT(ldexpl)(long double, int);
383#if 1 /* bird */
384long double RT_NOCRT(lgammal)(long double);
385long long RT_NOCRT(llrintl)(long double);
386#endif
387long long RT_NOCRT(llroundl)(long double);
388#if 1 /* bird */
389long double RT_NOCRT(log10l)(long double);
390long double RT_NOCRT(log1pl)(long double);
391long double RT_NOCRT(log2l)(long double);
392long double RT_NOCRT(logbl)(long double);
393long double RT_NOCRT(logl)(long double);
394long RT_NOCRT(lrintl)(long double);
395#endif
396long RT_NOCRT(lroundl)(long double);
397#if 1 /* bird */
398long double RT_NOCRT(modfl)(long double, long double *); /* fundamentally !__pure2 */
399long double RT_NOCRT(nanl)(const char *) __pure2;
400long double RT_NOCRT(nearbyintl)(long double);
401#endif
402long double RT_NOCRT(nextafterl)(long double, long double);
403double RT_NOCRT(nexttoward)(double, long double);
404float RT_NOCRT(nexttowardf)(float, long double);
405long double RT_NOCRT(nexttowardl)(long double, long double);
406#if 1 /* bird */
407long double RT_NOCRT(powl)(long double, long double);
408long double RT_NOCRT(remainderl)(long double, long double);
409long double RT_NOCRT(remquol)(long double, long double, int *);
410long double RT_NOCRT(rintl)(long double);
411#endif
412long double RT_NOCRT(roundl)(long double);
413long double RT_NOCRT(scalblnl)(long double, long);
414long double RT_NOCRT(scalbnl)(long double, int);
415#if 1 /* bird: we 've got most of these. */
416long double RT_NOCRT(sinhl)(long double);
417long double RT_NOCRT(sinl)(long double);
418long double RT_NOCRT(sqrtl)(long double);
419long double RT_NOCRT(tanhl)(long double);
420long double RT_NOCRT(tanl)(long double);
421long double RT_NOCRT(tgammal)(long double);
422#endif
423long double RT_NOCRT(truncl)(long double);
424
425/* bird: these were missing, gcc apparently inlines them. */
426double RT_NOCRT(nan)(const char *);
427float RT_NOCRT(nanf)(const char *);
428
429#endif /* __ISO_C_VISIBLE >= 1999 */
430
431#if 1/*def __USE_GNU*/
432/*
433 * In GLIBC there are long variants of the XOPEN/SVID constant
434 * block some pages ago. We need this to get the math tests going.
435 */
436#define M_El 2.7182818284590452353602874713526625L
437#define M_LOG2El 1.4426950408889634073599246810018921L
438#define M_LOG10El 0.4342944819032518276511289189166051L
439#define M_LN2l 0.6931471805599453094172321214581766L
440#define M_LN10l 2.3025850929940456840179914546843642L
441#define M_PIl 3.1415926535897932384626433832795029L
442#define M_PI_2l 1.5707963267948966192313216916397514L
443#define M_PI_4l 0.7853981633974483096156608458198757L
444#define M_1_PIl 0.3183098861837906715377675267450287L
445#define M_2_PIl 0.6366197723675813430755350534900574L
446#define M_2_SQRTPIl 1.1283791670955125738961589031215452L
447#define M_SQRT2l 1.4142135623730950488016887242096981L
448#define M_SQRT1_2l 0.7071067811865475244008443621048490L
449#endif
450
451#if 1/*def __USE_GNU*/
452
453void RT_NOCRT(sincos)(double, double *, double *);
454void RT_NOCRT(sincosf)(float, float *, float *);
455void RT_NOCRT(sincosl)(long double, long double *, long double *);
456float RT_NOCRT(exp10f)(float);
457double RT_NOCRT(exp10)(double);
458long double RT_NOCRT(exp10l)(long double);
459float RT_NOCRT(log2f)(float);
460double RT_NOCRT(log2)(double);
461long double RT_NOCRT(log2l)(long double);
462float RT_NOCRT(tgammaf)(float);
463long double RT_NOCRT(significandl)(long double);
464long double RT_NOCRT(j0l)(long double);
465long double RT_NOCRT(j1l)(long double);
466long double RT_NOCRT(jnl)(int, long double);
467long double RT_NOCRT(scalbl)(long double, long double);
468long double RT_NOCRT(y0l)(long double);
469long double RT_NOCRT(y1l)(long double);
470long double RT_NOCRT(ynl)(int, long double);
471long double RT_NOCRT(lgammal_r)(long double,int *);
472long double RT_NOCRT(gammal)(long double);
473#endif
474
475
476RT_C_DECLS_END
477
478
479/* bird 2022-08-03: moved this block down so we can prototype isnan & isinf without runnning into the macro forms. */
480#if 1 /* __ISO_C_VISIBLE >= 1999*/
481#define FP_ILOGB0 (-__INT_MAX)
482#define FP_ILOGBNAN __INT_MAX
483
484#ifdef __MATH_BUILTIN_CONSTANTS
485#define HUGE_VALF __builtin_huge_valf()
486#define HUGE_VALL __builtin_huge_vall()
487#define INFINITY __builtin_inf()
488#define NAN __builtin_nan("")
489#else
490#define HUGE_VALF (float)HUGE_VAL
491#define HUGE_VALL (long double)HUGE_VAL
492#define INFINITY HUGE_VALF
493#define NAN (__nan.__uf)
494#endif /* __MATH_BUILTIN_CONSTANTS */
495
496#ifndef IPRT_NO_CRT
497#define MATH_ERRNO 1
498#endif
499#define MATH_ERREXCEPT 2
500#define math_errhandling MATH_ERREXCEPT
501
502/* XXX We need a <machine/math.h>. */
503#if defined(__ia64__) || defined(__sparc64__)
504#define FP_FAST_FMA
505#endif
506#ifdef __ia64__
507#define FP_FAST_FMAL
508#endif
509#define FP_FAST_FMAF
510
511/* Symbolic constants to classify floating point numbers. */
512#define FP_INFINITE 0x01
513#define FP_NAN 0x02
514#define FP_NORMAL 0x04
515#define FP_SUBNORMAL 0x08
516#define FP_ZERO 0x10
517#define fpclassify(x) \
518 ((sizeof (x) == sizeof (float)) ? RT_NOCRT(__fpclassifyf)(x) \
519 : (sizeof (x) == sizeof (double)) ? RT_NOCRT(__fpclassifyd)(x) \
520 : RT_NOCRT(__fpclassifyl)(x))
521
522#define isfinite(x) \
523 ((sizeof (x) == sizeof (float)) ? RT_NOCRT(__isfinitef)(x) \
524 : (sizeof (x) == sizeof (double)) ? RT_NOCRT(__isfinite)(x) \
525 : RT_NOCRT(__isfinitel)(x))
526#define isinf(x) \
527 ((sizeof (x) == sizeof (float)) ? RT_NOCRT(__isinff)(x) \
528 : (sizeof (x) == sizeof (double)) ? RT_NOCRT(isinf)(x) \
529 : RT_NOCRT(__isinfl)(x))
530#define isnan(x) \
531 ((sizeof (x) == sizeof (float)) ? RT_NOCRT(isnanf)(x) \
532 : (sizeof (x) == sizeof (double)) ? RT_NOCRT(isnan)(x) \
533 : RT_NOCRT(__isnanl)(x))
534#define isnormal(x) \
535 ((sizeof (x) == sizeof (float)) ? RT_NOCRT(__isnormalf)(x) \
536 : (sizeof (x) == sizeof (double)) ? RT_NOCRT(__isnormal)(x) \
537 : RT_NOCRT(__isnormall)(x))
538
539#ifdef __MATH_BUILTIN_RELOPS
540#define isgreater(x, y) __builtin_isgreater((x), (y))
541#define isgreaterequal(x, y) __builtin_isgreaterequal((x), (y))
542#define isless(x, y) __builtin_isless((x), (y))
543#define islessequal(x, y) __builtin_islessequal((x), (y))
544#define islessgreater(x, y) __builtin_islessgreater((x), (y))
545#define isunordered(x, y) __builtin_isunordered((x), (y))
546#else
547#define isgreater(x, y) (!isunordered((x), (y)) && (x) > (y))
548#define isgreaterequal(x, y) (!isunordered((x), (y)) && (x) >= (y))
549#define isless(x, y) (!isunordered((x), (y)) && (x) < (y))
550#define islessequal(x, y) (!isunordered((x), (y)) && (x) <= (y))
551#define islessgreater(x, y) (!isunordered((x), (y)) && \
552 ((x) > (y) || (y) > (x)))
553#define isunordered(x, y) (isnan(x) || isnan(y))
554#endif /* __MATH_BUILTIN_RELOPS */
555
556#define signbit(x) \
557 ((sizeof (x) == sizeof (float)) ? RT_NOCRT(__signbitf)(x) \
558 : (sizeof (x) == sizeof (double)) ? RT_NOCRT(__signbit)(x) \
559 : RT_NOCRT(__signbitl)(x))
560
561typedef double double_t;
562typedef float float_t;
563#endif /* __ISO_C_VISIBLE >= 1999 */
564
565
566#if !defined(RT_WITHOUT_NOCRT_WRAPPERS) && !defined(RT_WITHOUT_NOCRT_WRAPPER_ALIASES)
567/* sed -e "/#/d" -e "/RT_NOCRT/!d" -e "s/^.*RT_NOCRT(\([a-z0-9_]*\)).*$/# define \1 RT_NOCRT(\1)/" */
568# define __infinity RT_NOCRT(__infinity)
569# define __nan RT_NOCRT(__nan)
570# define __fpclassifyf RT_NOCRT(__fpclassifyf)
571# define __fpclassifyd RT_NOCRT(__fpclassifyd)
572# define __fpclassifyl RT_NOCRT(__fpclassifyl)
573# define __isfinitef RT_NOCRT(__isfinitef)
574# define __isfinite RT_NOCRT(__isfinite)
575# define __isfinitel RT_NOCRT(__isfinitel)
576# define __isinff RT_NOCRT(__isinff)
577# define __isinfl RT_NOCRT(__isinfl)
578# define __isnanl RT_NOCRT(__isnanl)
579# define __isnormalf RT_NOCRT(__isnormalf)
580# define __isnormal RT_NOCRT(__isnormal)
581# define __isnormall RT_NOCRT(__isnormall)
582# define __signbitf RT_NOCRT(__signbitf)
583# define __signbit RT_NOCRT(__signbit)
584# define __signbitl RT_NOCRT(__signbitl)
585# define signgam RT_NOCRT(signgam)
586# define __fpclassifyd RT_NOCRT(__fpclassifyd)
587# define __fpclassifyf RT_NOCRT(__fpclassifyf)
588# define __fpclassifyl RT_NOCRT(__fpclassifyl)
589# define __isfinitef RT_NOCRT(__isfinitef)
590# define __isfinite RT_NOCRT(__isfinite)
591# define __isfinitel RT_NOCRT(__isfinitel)
592# define __isinff RT_NOCRT(__isinff)
593# define __isinfl RT_NOCRT(__isinfl)
594# define __isnanl RT_NOCRT(__isnanl)
595# define __isnormalf RT_NOCRT(__isnormalf)
596# define __isnormal RT_NOCRT(__isnormal)
597# define __isnormall RT_NOCRT(__isnormall)
598# define __signbit RT_NOCRT(__signbit)
599# define __signbitf RT_NOCRT(__signbitf)
600# define __signbitl RT_NOCRT(__signbitl)
601# define acos RT_NOCRT(acos)
602# define asin RT_NOCRT(asin)
603# define atan RT_NOCRT(atan)
604# define atan2 RT_NOCRT(atan2)
605# define cos RT_NOCRT(cos)
606# define sin RT_NOCRT(sin)
607# define tan RT_NOCRT(tan)
608# define cosh RT_NOCRT(cosh)
609# define sinh RT_NOCRT(sinh)
610# define tanh RT_NOCRT(tanh)
611# define exp RT_NOCRT(exp)
612# define frexp RT_NOCRT(frexp)
613# define ldexp RT_NOCRT(ldexp)
614# define log RT_NOCRT(log)
615# define log10 RT_NOCRT(log10)
616# define modf RT_NOCRT(modf)
617# define pow RT_NOCRT(pow)
618# define sqrt RT_NOCRT(sqrt)
619# define ceil RT_NOCRT(ceil)
620# define fabs RT_NOCRT(fabs)
621# define floor RT_NOCRT(floor)
622# define fmod RT_NOCRT(fmod)
623# define acosh RT_NOCRT(acosh)
624# define asinh RT_NOCRT(asinh)
625# define atanh RT_NOCRT(atanh)
626# define cbrt RT_NOCRT(cbrt)
627# define erf RT_NOCRT(erf)
628# define erfc RT_NOCRT(erfc)
629# define exp2 RT_NOCRT(exp2)
630# define expm1 RT_NOCRT(expm1)
631# define fma RT_NOCRT(fma)
632# define hypot RT_NOCRT(hypot)
633# define ilogb RT_NOCRT(ilogb)
634# define lgamma RT_NOCRT(lgamma)
635# define llrint RT_NOCRT(llrint)
636# define llround RT_NOCRT(llround)
637# define log1p RT_NOCRT(log1p)
638# define logb RT_NOCRT(logb)
639# define lrint RT_NOCRT(lrint)
640# define lround RT_NOCRT(lround)
641# define nextafter RT_NOCRT(nextafter)
642# define remainder RT_NOCRT(remainder)
643# define remquo RT_NOCRT(remquo)
644# define rint RT_NOCRT(rint)
645# define j0 RT_NOCRT(j0)
646# define j1 RT_NOCRT(j1)
647# define jn RT_NOCRT(jn)
648# define scalb RT_NOCRT(scalb)
649# define y0 RT_NOCRT(y0)
650# define y1 RT_NOCRT(y1)
651# define yn RT_NOCRT(yn)
652# define gamma RT_NOCRT(gamma)
653# define copysign RT_NOCRT(copysign)
654# define fdim RT_NOCRT(fdim)
655# define fmax RT_NOCRT(fmax)
656# define fmin RT_NOCRT(fmin)
657# define nearbyint RT_NOCRT(nearbyint)
658# define round RT_NOCRT(round)
659# define scalbln RT_NOCRT(scalbln)
660# define scalbn RT_NOCRT(scalbn)
661# define tgamma RT_NOCRT(tgamma)
662# define trunc RT_NOCRT(trunc)
663# define drem RT_NOCRT(drem)
664# define finite RT_NOCRT(finite)
665/*# define isinf RT_NOCRT(isinf) - already a macro */
666/*# define isnan RT_NOCRT(isnan) - already a macro */
667# define isnanf RT_NOCRT(isnanf)
668# define gamma_r RT_NOCRT(gamma_r)
669# define lgamma_r RT_NOCRT(lgamma_r)
670# define significand RT_NOCRT(significand)
671# define acosf RT_NOCRT(acosf)
672# define asinf RT_NOCRT(asinf)
673# define atanf RT_NOCRT(atanf)
674# define atan2f RT_NOCRT(atan2f)
675# define cosf RT_NOCRT(cosf)
676# define sinf RT_NOCRT(sinf)
677# define tanf RT_NOCRT(tanf)
678# define coshf RT_NOCRT(coshf)
679# define sinhf RT_NOCRT(sinhf)
680# define tanhf RT_NOCRT(tanhf)
681# define exp2f RT_NOCRT(exp2f)
682# define expf RT_NOCRT(expf)
683# define expm1f RT_NOCRT(expm1f)
684# define frexpf RT_NOCRT(frexpf)
685# define ilogbf RT_NOCRT(ilogbf)
686# define ldexpf RT_NOCRT(ldexpf)
687# define log10f RT_NOCRT(log10f)
688# define log1pf RT_NOCRT(log1pf)
689# define logf RT_NOCRT(logf)
690# define modff RT_NOCRT(modff)
691# define powf RT_NOCRT(powf)
692# define sqrtf RT_NOCRT(sqrtf)
693# define ceilf RT_NOCRT(ceilf)
694# define fabsf RT_NOCRT(fabsf)
695# define floorf RT_NOCRT(floorf)
696# define fmodf RT_NOCRT(fmodf)
697# define roundf RT_NOCRT(roundf)
698# define erff RT_NOCRT(erff)
699# define erfcf RT_NOCRT(erfcf)
700# define hypotf RT_NOCRT(hypotf)
701# define lgammaf RT_NOCRT(lgammaf)
702# define acoshf RT_NOCRT(acoshf)
703# define asinhf RT_NOCRT(asinhf)
704# define atanhf RT_NOCRT(atanhf)
705# define cbrtf RT_NOCRT(cbrtf)
706# define logbf RT_NOCRT(logbf)
707# define copysignf RT_NOCRT(copysignf)
708# define llrintf RT_NOCRT(llrintf)
709# define llroundf RT_NOCRT(llroundf)
710# define lrintf RT_NOCRT(lrintf)
711# define lroundf RT_NOCRT(lroundf)
712# define nearbyintf RT_NOCRT(nearbyintf)
713# define nextafterf RT_NOCRT(nextafterf)
714# define remainderf RT_NOCRT(remainderf)
715# define remquof RT_NOCRT(remquof)
716# define rintf RT_NOCRT(rintf)
717# define scalblnf RT_NOCRT(scalblnf)
718# define scalbnf RT_NOCRT(scalbnf)
719# define truncf RT_NOCRT(truncf)
720# define fdimf RT_NOCRT(fdimf)
721# define fmaf RT_NOCRT(fmaf)
722# define fmaxf RT_NOCRT(fmaxf)
723# define fminf RT_NOCRT(fminf)
724# define dremf RT_NOCRT(dremf)
725# define finitef RT_NOCRT(finitef)
726# define gammaf RT_NOCRT(gammaf)
727# define j0f RT_NOCRT(j0f)
728# define j1f RT_NOCRT(j1f)
729# define jnf RT_NOCRT(jnf)
730# define scalbf RT_NOCRT(scalbf)
731# define y0f RT_NOCRT(y0f)
732# define y1f RT_NOCRT(y1f)
733# define ynf RT_NOCRT(ynf)
734# define gammaf_r RT_NOCRT(gammaf_r)
735# define lgammaf_r RT_NOCRT(lgammaf_r)
736# define significandf RT_NOCRT(significandf)
737# define acoshl RT_NOCRT(acoshl)
738# define acosl RT_NOCRT(acosl)
739# define asinhl RT_NOCRT(asinhl)
740# define asinl RT_NOCRT(asinl)
741# define atan2l RT_NOCRT(atan2l)
742# define atanhl RT_NOCRT(atanhl)
743# define atanl RT_NOCRT(atanl)
744# define cbrtl RT_NOCRT(cbrtl)
745# define ceill RT_NOCRT(ceill)
746# define copysignl RT_NOCRT(copysignl)
747# define coshl RT_NOCRT(coshl)
748# define cosl RT_NOCRT(cosl)
749# define erfcl RT_NOCRT(erfcl)
750# define erfl RT_NOCRT(erfl)
751# define exp2l RT_NOCRT(exp2l)
752# define expl RT_NOCRT(expl)
753# define expm1l RT_NOCRT(expm1l)
754# define fabsl RT_NOCRT(fabsl)
755# define fdiml RT_NOCRT(fdiml)
756# define floorl RT_NOCRT(floorl)
757# define fmal RT_NOCRT(fmal)
758# define fmaxl RT_NOCRT(fmaxl)
759# define fminl RT_NOCRT(fminl)
760# define fmodl RT_NOCRT(fmodl)
761# define frexpl RT_NOCRT(frexpl)
762# define hypotl RT_NOCRT(hypotl)
763# define ilogbl RT_NOCRT(ilogbl)
764# define ldexpl RT_NOCRT(ldexpl)
765# define lgammal RT_NOCRT(lgammal)
766# define llrintl RT_NOCRT(llrintl)
767# define llroundl RT_NOCRT(llroundl)
768# define log10l RT_NOCRT(log10l)
769# define log1pl RT_NOCRT(log1pl)
770# define log2l RT_NOCRT(log2l)
771# define logbl RT_NOCRT(logbl)
772# define logl RT_NOCRT(logl)
773# define lrintl RT_NOCRT(lrintl)
774# define lroundl RT_NOCRT(lroundl)
775# define modfl RT_NOCRT(modfl)
776# define nanl RT_NOCRT(nanl)
777# define nearbyintl RT_NOCRT(nearbyintl)
778# define nextafterl RT_NOCRT(nextafterl)
779# define nexttoward RT_NOCRT(nexttoward)
780# define nexttowardf RT_NOCRT(nexttowardf)
781# define nexttowardl RT_NOCRT(nexttowardl)
782# define powl RT_NOCRT(powl)
783# define remainderl RT_NOCRT(remainderl)
784# define remquol RT_NOCRT(remquol)
785# define rintl RT_NOCRT(rintl)
786# define roundl RT_NOCRT(roundl)
787# define scalblnl RT_NOCRT(scalblnl)
788# define scalbnl RT_NOCRT(scalbnl)
789# define sinhl RT_NOCRT(sinhl)
790# define sinl RT_NOCRT(sinl)
791# define sqrtl RT_NOCRT(sqrtl)
792# define tanhl RT_NOCRT(tanhl)
793# define tanl RT_NOCRT(tanl)
794# define tgammal RT_NOCRT(tgammal)
795# define truncl RT_NOCRT(truncl)
796# define nan RT_NOCRT(nan)
797# define nanf RT_NOCRT(nanf)
798# define sincos RT_NOCRT(sincos)
799# define sincosf RT_NOCRT(sincosf)
800# define sincosl RT_NOCRT(sincosl)
801# define exp10f RT_NOCRT(exp10f)
802# define exp10 RT_NOCRT(exp10)
803# define exp10l RT_NOCRT(exp10l)
804# define log2f RT_NOCRT(log2f)
805# define log2 RT_NOCRT(log2)
806# define log2l RT_NOCRT(log2l)
807# define tgammaf RT_NOCRT(tgammaf)
808# define significandl RT_NOCRT(significandl)
809# define j0l RT_NOCRT(j0l)
810# define j1l RT_NOCRT(j1l)
811# define jnl RT_NOCRT(jnl)
812# define scalbl RT_NOCRT(scalbl)
813# define y0l RT_NOCRT(y0l)
814# define y1l RT_NOCRT(y1l)
815# define ynl RT_NOCRT(ynl)
816# define lgammal_r RT_NOCRT(lgammal_r)
817# define gammal RT_NOCRT(gammal)
818#endif
819
820/*
821 * Include inlined implementations.
822 */
823#ifdef RT_ARCH_AMD64
824# include <iprt/nocrt/amd64/math.h>
825#elif defined(RT_ARCH_X86)
826# include <iprt/nocrt/x86/math.h>
827#endif
828
829#endif /* !IPRT_INCLUDED_nocrt_math_h */
830
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette