1*25c28e83SPiotr Jasiukajtis /* 2*25c28e83SPiotr Jasiukajtis * CDDL HEADER START 3*25c28e83SPiotr Jasiukajtis * 4*25c28e83SPiotr Jasiukajtis * The contents of this file are subject to the terms of the 5*25c28e83SPiotr Jasiukajtis * Common Development and Distribution License (the "License"). 6*25c28e83SPiotr Jasiukajtis * You may not use this file except in compliance with the License. 7*25c28e83SPiotr Jasiukajtis * 8*25c28e83SPiotr Jasiukajtis * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*25c28e83SPiotr Jasiukajtis * or http://www.opensolaris.org/os/licensing. 10*25c28e83SPiotr Jasiukajtis * See the License for the specific language governing permissions 11*25c28e83SPiotr Jasiukajtis * and limitations under the License. 12*25c28e83SPiotr Jasiukajtis * 13*25c28e83SPiotr Jasiukajtis * When distributing Covered Code, include this CDDL HEADER in each 14*25c28e83SPiotr Jasiukajtis * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*25c28e83SPiotr Jasiukajtis * If applicable, add the following below this CDDL HEADER, with the 16*25c28e83SPiotr Jasiukajtis * fields enclosed by brackets "[]" replaced with your own identifying 17*25c28e83SPiotr Jasiukajtis * information: Portions Copyright [yyyy] [name of copyright owner] 18*25c28e83SPiotr Jasiukajtis * 19*25c28e83SPiotr Jasiukajtis * CDDL HEADER END 20*25c28e83SPiotr Jasiukajtis */ 21*25c28e83SPiotr Jasiukajtis /* 22*25c28e83SPiotr Jasiukajtis * Copyright 2011 Nexenta Systems, Inc. All rights reserved. 23*25c28e83SPiotr Jasiukajtis */ 24*25c28e83SPiotr Jasiukajtis /* 25*25c28e83SPiotr Jasiukajtis * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 26*25c28e83SPiotr Jasiukajtis * Use is subject to license terms. 27*25c28e83SPiotr Jasiukajtis */ 28*25c28e83SPiotr Jasiukajtis 29*25c28e83SPiotr Jasiukajtis #ifndef _MATH_H 30*25c28e83SPiotr Jasiukajtis #define _MATH_H 31*25c28e83SPiotr Jasiukajtis 32*25c28e83SPiotr Jasiukajtis #include <iso/math_iso.h> 33*25c28e83SPiotr Jasiukajtis #include <iso/math_c99.h> 34*25c28e83SPiotr Jasiukajtis 35*25c28e83SPiotr Jasiukajtis #if __cplusplus >= 199711L 36*25c28e83SPiotr Jasiukajtis using std::abs; 37*25c28e83SPiotr Jasiukajtis using std::acos; 38*25c28e83SPiotr Jasiukajtis using std::asin; 39*25c28e83SPiotr Jasiukajtis using std::atan2; 40*25c28e83SPiotr Jasiukajtis using std::atan; 41*25c28e83SPiotr Jasiukajtis using std::ceil; 42*25c28e83SPiotr Jasiukajtis using std::cos; 43*25c28e83SPiotr Jasiukajtis using std::cosh; 44*25c28e83SPiotr Jasiukajtis using std::exp; 45*25c28e83SPiotr Jasiukajtis using std::fabs; 46*25c28e83SPiotr Jasiukajtis using std::floor; 47*25c28e83SPiotr Jasiukajtis using std::fmod; 48*25c28e83SPiotr Jasiukajtis using std::frexp; 49*25c28e83SPiotr Jasiukajtis using std::ldexp; 50*25c28e83SPiotr Jasiukajtis using std::log10; 51*25c28e83SPiotr Jasiukajtis using std::log; 52*25c28e83SPiotr Jasiukajtis using std::modf; 53*25c28e83SPiotr Jasiukajtis using std::pow; 54*25c28e83SPiotr Jasiukajtis using std::sin; 55*25c28e83SPiotr Jasiukajtis using std::sinh; 56*25c28e83SPiotr Jasiukajtis using std::sqrt; 57*25c28e83SPiotr Jasiukajtis using std::tan; 58*25c28e83SPiotr Jasiukajtis using std::tanh; 59*25c28e83SPiotr Jasiukajtis #endif 60*25c28e83SPiotr Jasiukajtis 61*25c28e83SPiotr Jasiukajtis #ifdef __cplusplus 62*25c28e83SPiotr Jasiukajtis extern "C" { 63*25c28e83SPiotr Jasiukajtis #endif 64*25c28e83SPiotr Jasiukajtis 65*25c28e83SPiotr Jasiukajtis #if defined(__cplusplus) 66*25c28e83SPiotr Jasiukajtis #define exception __math_exception 67*25c28e83SPiotr Jasiukajtis #endif 68*25c28e83SPiotr Jasiukajtis 69*25c28e83SPiotr Jasiukajtis #ifndef __P 70*25c28e83SPiotr Jasiukajtis #ifdef __STDC__ 71*25c28e83SPiotr Jasiukajtis #define __P(p) p 72*25c28e83SPiotr Jasiukajtis #else 73*25c28e83SPiotr Jasiukajtis #define __P(p) () 74*25c28e83SPiotr Jasiukajtis #endif 75*25c28e83SPiotr Jasiukajtis #endif /* !defined(__P) */ 76*25c28e83SPiotr Jasiukajtis 77*25c28e83SPiotr Jasiukajtis #if defined(__EXTENSIONS__) || defined(_XOPEN_SOURCE) || \ 78*25c28e83SPiotr Jasiukajtis !defined(_STRICT_STDC) && !defined(_POSIX_C_SOURCE) 79*25c28e83SPiotr Jasiukajtis /* 80*25c28e83SPiotr Jasiukajtis * SVID & X/Open 81*25c28e83SPiotr Jasiukajtis */ 82*25c28e83SPiotr Jasiukajtis #define M_E 2.7182818284590452354 83*25c28e83SPiotr Jasiukajtis #define M_LOG2E 1.4426950408889634074 84*25c28e83SPiotr Jasiukajtis #define M_LOG10E 0.43429448190325182765 85*25c28e83SPiotr Jasiukajtis #define M_LN2 0.69314718055994530942 86*25c28e83SPiotr Jasiukajtis #define M_LN10 2.30258509299404568402 87*25c28e83SPiotr Jasiukajtis #define M_PI 3.14159265358979323846 88*25c28e83SPiotr Jasiukajtis #define M_PI_2 1.57079632679489661923 89*25c28e83SPiotr Jasiukajtis #define M_PI_4 0.78539816339744830962 90*25c28e83SPiotr Jasiukajtis #define M_1_PI 0.31830988618379067154 91*25c28e83SPiotr Jasiukajtis #define M_2_PI 0.63661977236758134308 92*25c28e83SPiotr Jasiukajtis #define M_2_SQRTPI 1.12837916709551257390 93*25c28e83SPiotr Jasiukajtis #define M_SQRT2 1.41421356237309504880 94*25c28e83SPiotr Jasiukajtis #define M_SQRT1_2 0.70710678118654752440 95*25c28e83SPiotr Jasiukajtis 96*25c28e83SPiotr Jasiukajtis extern int signgam; 97*25c28e83SPiotr Jasiukajtis 98*25c28e83SPiotr Jasiukajtis #define MAXFLOAT ((float)3.40282346638528860e+38) 99*25c28e83SPiotr Jasiukajtis 100*25c28e83SPiotr Jasiukajtis #if defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) 101*25c28e83SPiotr Jasiukajtis /* 102*25c28e83SPiotr Jasiukajtis * SVID 103*25c28e83SPiotr Jasiukajtis */ 104*25c28e83SPiotr Jasiukajtis enum version {libm_ieee = -1, c_issue_4, ansi_1, strict_ansi}; 105*25c28e83SPiotr Jasiukajtis 106*25c28e83SPiotr Jasiukajtis #ifdef __STDC__ 107*25c28e83SPiotr Jasiukajtis extern const enum version _lib_version; 108*25c28e83SPiotr Jasiukajtis #else 109*25c28e83SPiotr Jasiukajtis extern enum version _lib_version; 110*25c28e83SPiotr Jasiukajtis #endif 111*25c28e83SPiotr Jasiukajtis 112*25c28e83SPiotr Jasiukajtis struct exception { 113*25c28e83SPiotr Jasiukajtis int type; 114*25c28e83SPiotr Jasiukajtis char *name; 115*25c28e83SPiotr Jasiukajtis double arg1; 116*25c28e83SPiotr Jasiukajtis double arg2; 117*25c28e83SPiotr Jasiukajtis double retval; 118*25c28e83SPiotr Jasiukajtis }; 119*25c28e83SPiotr Jasiukajtis 120*25c28e83SPiotr Jasiukajtis #define HUGE MAXFLOAT 121*25c28e83SPiotr Jasiukajtis 122*25c28e83SPiotr Jasiukajtis #define _ABS(x) ((x) < 0 ? -(x) : (x)) 123*25c28e83SPiotr Jasiukajtis 124*25c28e83SPiotr Jasiukajtis #define _REDUCE(TYPE, X, XN, C1, C2) { \ 125*25c28e83SPiotr Jasiukajtis double x1 = (double)(TYPE)X, x2 = X - x1; \ 126*25c28e83SPiotr Jasiukajtis X = x1 - (XN) * (C1); X += x2; X -= (XN) * (C2); } 127*25c28e83SPiotr Jasiukajtis 128*25c28e83SPiotr Jasiukajtis #define DOMAIN 1 129*25c28e83SPiotr Jasiukajtis #define SING 2 130*25c28e83SPiotr Jasiukajtis #define OVERFLOW 3 131*25c28e83SPiotr Jasiukajtis #define UNDERFLOW 4 132*25c28e83SPiotr Jasiukajtis #define TLOSS 5 133*25c28e83SPiotr Jasiukajtis #define PLOSS 6 134*25c28e83SPiotr Jasiukajtis 135*25c28e83SPiotr Jasiukajtis #define _POLY1(x, c) ((c)[0] * (x) + (c)[1]) 136*25c28e83SPiotr Jasiukajtis #define _POLY2(x, c) (_POLY1((x), (c)) * (x) + (c)[2]) 137*25c28e83SPiotr Jasiukajtis #define _POLY3(x, c) (_POLY2((x), (c)) * (x) + (c)[3]) 138*25c28e83SPiotr Jasiukajtis #define _POLY4(x, c) (_POLY3((x), (c)) * (x) + (c)[4]) 139*25c28e83SPiotr Jasiukajtis #define _POLY5(x, c) (_POLY4((x), (c)) * (x) + (c)[5]) 140*25c28e83SPiotr Jasiukajtis #define _POLY6(x, c) (_POLY5((x), (c)) * (x) + (c)[6]) 141*25c28e83SPiotr Jasiukajtis #define _POLY7(x, c) (_POLY6((x), (c)) * (x) + (c)[7]) 142*25c28e83SPiotr Jasiukajtis #define _POLY8(x, c) (_POLY7((x), (c)) * (x) + (c)[8]) 143*25c28e83SPiotr Jasiukajtis #define _POLY9(x, c) (_POLY8((x), (c)) * (x) + (c)[9]) 144*25c28e83SPiotr Jasiukajtis #endif /* defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) */ 145*25c28e83SPiotr Jasiukajtis 146*25c28e83SPiotr Jasiukajtis /* 147*25c28e83SPiotr Jasiukajtis * SVID & X/Open 148*25c28e83SPiotr Jasiukajtis */ 149*25c28e83SPiotr Jasiukajtis /* BEGIN adopted by C99 */ 150*25c28e83SPiotr Jasiukajtis extern double erf __P((double)); 151*25c28e83SPiotr Jasiukajtis extern double erfc __P((double)); 152*25c28e83SPiotr Jasiukajtis extern double hypot __P((double, double)); 153*25c28e83SPiotr Jasiukajtis extern double lgamma __P((double)); 154*25c28e83SPiotr Jasiukajtis 155*25c28e83SPiotr Jasiukajtis #if defined(__MATHERR_ERRNO_DONTCARE) 156*25c28e83SPiotr Jasiukajtis #pragma does_not_read_global_data(erf, erfc, hypot) 157*25c28e83SPiotr Jasiukajtis #pragma does_not_write_global_data(erf, erfc, hypot) 158*25c28e83SPiotr Jasiukajtis #pragma no_side_effect(erf, erfc, hypot) 159*25c28e83SPiotr Jasiukajtis #endif 160*25c28e83SPiotr Jasiukajtis 161*25c28e83SPiotr Jasiukajtis #if !defined(_STDC_C99) && _XOPEN_SOURCE - 0 < 600 && !defined(__C99FEATURES__) 162*25c28e83SPiotr Jasiukajtis extern int isnan __P((double)); 163*25c28e83SPiotr Jasiukajtis 164*25c28e83SPiotr Jasiukajtis #pragma does_not_read_global_data(isnan) 165*25c28e83SPiotr Jasiukajtis #pragma does_not_write_global_data(isnan) 166*25c28e83SPiotr Jasiukajtis #pragma no_side_effect(isnan) 167*25c28e83SPiotr Jasiukajtis #endif 168*25c28e83SPiotr Jasiukajtis /* END adopted by C99 */ 169*25c28e83SPiotr Jasiukajtis 170*25c28e83SPiotr Jasiukajtis #if defined(__EXTENSIONS__) || _XOPEN_SOURCE - 0 < 600 171*25c28e83SPiotr Jasiukajtis extern double gamma __P((double)); /* deprecated; use lgamma */ 172*25c28e83SPiotr Jasiukajtis #endif 173*25c28e83SPiotr Jasiukajtis extern double j0 __P((double)); 174*25c28e83SPiotr Jasiukajtis extern double j1 __P((double)); 175*25c28e83SPiotr Jasiukajtis extern double jn __P((int, double)); 176*25c28e83SPiotr Jasiukajtis extern double y0 __P((double)); 177*25c28e83SPiotr Jasiukajtis extern double y1 __P((double)); 178*25c28e83SPiotr Jasiukajtis extern double yn __P((int, double)); 179*25c28e83SPiotr Jasiukajtis 180*25c28e83SPiotr Jasiukajtis #if defined(__MATHERR_ERRNO_DONTCARE) 181*25c28e83SPiotr Jasiukajtis #pragma does_not_read_global_data(j0, j1, jn, y0, y1, yn) 182*25c28e83SPiotr Jasiukajtis #pragma does_not_write_global_data(j0, j1, jn, y0, y1, yn) 183*25c28e83SPiotr Jasiukajtis #pragma no_side_effect(j0, j1, jn, y0, y1, yn) 184*25c28e83SPiotr Jasiukajtis #endif 185*25c28e83SPiotr Jasiukajtis #if defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) || \ 186*25c28e83SPiotr Jasiukajtis _XOPEN_SOURCE - 0 >= 500 || \ 187*25c28e83SPiotr Jasiukajtis defined(_XOPEN_SOURCE) && _XOPEN_SOURCE_EXTENDED - 0 == 1 188*25c28e83SPiotr Jasiukajtis /* 189*25c28e83SPiotr Jasiukajtis * SVID & XPG 4.2/5 190*25c28e83SPiotr Jasiukajtis */ 191*25c28e83SPiotr Jasiukajtis extern double scalb __P((double, double)); 192*25c28e83SPiotr Jasiukajtis 193*25c28e83SPiotr Jasiukajtis #if defined(__MATHERR_ERRNO_DONTCARE) 194*25c28e83SPiotr Jasiukajtis #pragma does_not_read_global_data(scalb) 195*25c28e83SPiotr Jasiukajtis #pragma does_not_write_global_data(scalb) 196*25c28e83SPiotr Jasiukajtis #pragma no_side_effect(scalb) 197*25c28e83SPiotr Jasiukajtis #endif 198*25c28e83SPiotr Jasiukajtis 199*25c28e83SPiotr Jasiukajtis /* BEGIN adopted by C99 */ 200*25c28e83SPiotr Jasiukajtis extern double acosh __P((double)); 201*25c28e83SPiotr Jasiukajtis extern double asinh __P((double)); 202*25c28e83SPiotr Jasiukajtis extern double atanh __P((double)); 203*25c28e83SPiotr Jasiukajtis extern double cbrt __P((double)); 204*25c28e83SPiotr Jasiukajtis extern double logb __P((double)); 205*25c28e83SPiotr Jasiukajtis extern double nextafter __P((double, double)); 206*25c28e83SPiotr Jasiukajtis extern double remainder __P((double, double)); 207*25c28e83SPiotr Jasiukajtis 208*25c28e83SPiotr Jasiukajtis /* 209*25c28e83SPiotr Jasiukajtis * XPG 4.2/5 210*25c28e83SPiotr Jasiukajtis */ 211*25c28e83SPiotr Jasiukajtis extern double expm1 __P((double)); 212*25c28e83SPiotr Jasiukajtis extern int ilogb __P((double)); 213*25c28e83SPiotr Jasiukajtis extern double log1p __P((double)); 214*25c28e83SPiotr Jasiukajtis extern double rint __P((double)); 215*25c28e83SPiotr Jasiukajtis 216*25c28e83SPiotr Jasiukajtis #if defined(__MATHERR_ERRNO_DONTCARE) 217*25c28e83SPiotr Jasiukajtis #pragma does_not_read_global_data(acosh, asinh, atanh, cbrt) 218*25c28e83SPiotr Jasiukajtis #pragma does_not_read_global_data(logb, nextafter, remainder) 219*25c28e83SPiotr Jasiukajtis #pragma does_not_read_global_data(expm1, ilogb, log1p, rint) 220*25c28e83SPiotr Jasiukajtis #pragma does_not_write_global_data(acosh, asinh, atanh, cbrt) 221*25c28e83SPiotr Jasiukajtis #pragma does_not_write_global_data(logb, nextafter, remainder) 222*25c28e83SPiotr Jasiukajtis #pragma does_not_write_global_data(expm1, ilogb, log1p, rint) 223*25c28e83SPiotr Jasiukajtis #pragma no_side_effect(acosh, asinh, atanh, cbrt) 224*25c28e83SPiotr Jasiukajtis #pragma no_side_effect(logb, nextafter, remainder) 225*25c28e83SPiotr Jasiukajtis #pragma no_side_effect(expm1, ilogb, log1p, rint) 226*25c28e83SPiotr Jasiukajtis #endif 227*25c28e83SPiotr Jasiukajtis /* END adopted by C99 */ 228*25c28e83SPiotr Jasiukajtis #endif /* defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) || ... */ 229*25c28e83SPiotr Jasiukajtis 230*25c28e83SPiotr Jasiukajtis #if defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) 231*25c28e83SPiotr Jasiukajtis /* 232*25c28e83SPiotr Jasiukajtis * SVID 233*25c28e83SPiotr Jasiukajtis */ 234*25c28e83SPiotr Jasiukajtis extern int matherr __P((struct exception *)); 235*25c28e83SPiotr Jasiukajtis 236*25c28e83SPiotr Jasiukajtis /* 237*25c28e83SPiotr Jasiukajtis * IEEE Test Vector 238*25c28e83SPiotr Jasiukajtis */ 239*25c28e83SPiotr Jasiukajtis extern double significand __P((double)); 240*25c28e83SPiotr Jasiukajtis 241*25c28e83SPiotr Jasiukajtis #if defined(__MATHERR_ERRNO_DONTCARE) 242*25c28e83SPiotr Jasiukajtis #pragma does_not_read_global_data(significand) 243*25c28e83SPiotr Jasiukajtis #pragma does_not_write_global_data(significand) 244*25c28e83SPiotr Jasiukajtis #pragma no_side_effect(significand) 245*25c28e83SPiotr Jasiukajtis #endif 246*25c28e83SPiotr Jasiukajtis 247*25c28e83SPiotr Jasiukajtis extern int signgamf; /* deprecated; use signgam */ 248*25c28e83SPiotr Jasiukajtis extern int signgaml; /* deprecated; use signgam */ 249*25c28e83SPiotr Jasiukajtis 250*25c28e83SPiotr Jasiukajtis extern int isnanf __P((float)); 251*25c28e83SPiotr Jasiukajtis extern int isnanl __P((long double)); 252*25c28e83SPiotr Jasiukajtis extern float gammaf __P((float)); /* deprecated; use lgammaf */ 253*25c28e83SPiotr Jasiukajtis extern float gammaf_r __P((float, int *)); /* deprecated; use lgammaf_r */ 254*25c28e83SPiotr Jasiukajtis extern float j0f __P((float)); 255*25c28e83SPiotr Jasiukajtis extern float j1f __P((float)); 256*25c28e83SPiotr Jasiukajtis extern float jnf __P((int, float)); 257*25c28e83SPiotr Jasiukajtis extern float lgammaf_r __P((float, int *)); 258*25c28e83SPiotr Jasiukajtis extern float scalbf __P((float, float)); 259*25c28e83SPiotr Jasiukajtis extern float significandf __P((float)); 260*25c28e83SPiotr Jasiukajtis extern float y0f __P((float)); 261*25c28e83SPiotr Jasiukajtis extern float y1f __P((float)); 262*25c28e83SPiotr Jasiukajtis extern float ynf __P((int, float)); 263*25c28e83SPiotr Jasiukajtis extern long double gammal __P((long double)); /* deprecated; use lgammal */ 264*25c28e83SPiotr Jasiukajtis extern long double gammal_r __P((long double, int *)); /* deprecated */ 265*25c28e83SPiotr Jasiukajtis extern long double j0l __P((long double)); 266*25c28e83SPiotr Jasiukajtis extern long double j1l __P((long double)); 267*25c28e83SPiotr Jasiukajtis extern long double jnl __P((int, long double)); 268*25c28e83SPiotr Jasiukajtis extern long double lgammal_r __P((long double, int *)); 269*25c28e83SPiotr Jasiukajtis extern long double scalbl __P((long double, long double)); 270*25c28e83SPiotr Jasiukajtis extern long double significandl __P((long double)); 271*25c28e83SPiotr Jasiukajtis extern long double y0l __P((long double)); 272*25c28e83SPiotr Jasiukajtis extern long double y1l __P((long double)); 273*25c28e83SPiotr Jasiukajtis extern long double ynl __P((int, long double)); 274*25c28e83SPiotr Jasiukajtis 275*25c28e83SPiotr Jasiukajtis #if defined(__MATHERR_ERRNO_DONTCARE) 276*25c28e83SPiotr Jasiukajtis #pragma does_not_read_global_data(isnanf, isnanl) 277*25c28e83SPiotr Jasiukajtis #pragma does_not_write_global_data(isnanf, isnanl) 278*25c28e83SPiotr Jasiukajtis #pragma no_side_effect(isnanf, isnanl) 279*25c28e83SPiotr Jasiukajtis #pragma does_not_read_global_data(gammaf_r, j0f, j1f, jnf, lgammaf_r, scalbf) 280*25c28e83SPiotr Jasiukajtis #pragma does_not_read_global_data(significandf, y0f, y1f, ynf) 281*25c28e83SPiotr Jasiukajtis #pragma does_not_write_global_data(j0f, j1f, jnf, scalbf) 282*25c28e83SPiotr Jasiukajtis #pragma does_not_write_global_data(significandf, y0f, y1f, ynf) 283*25c28e83SPiotr Jasiukajtis #pragma no_side_effect(j0f, j1f, jnf, scalbf) 284*25c28e83SPiotr Jasiukajtis #pragma no_side_effect(significandf, y0f, y1f, ynf) 285*25c28e83SPiotr Jasiukajtis #pragma does_not_read_global_data(gammal_r, j0l, j1l, jnl, lgammal_r, scalbl) 286*25c28e83SPiotr Jasiukajtis #pragma does_not_read_global_data(significandl, y0l, y1l, ynl) 287*25c28e83SPiotr Jasiukajtis #pragma does_not_write_global_data(j0l, j1l, jnl, scalbl) 288*25c28e83SPiotr Jasiukajtis #pragma does_not_write_global_data(significandl, y0l, y1l, ynl) 289*25c28e83SPiotr Jasiukajtis #pragma no_side_effect(j0l, j1l, jnl, scalbl) 290*25c28e83SPiotr Jasiukajtis #pragma no_side_effect(significandl, y0l, y1l, ynl) 291*25c28e83SPiotr Jasiukajtis #endif 292*25c28e83SPiotr Jasiukajtis 293*25c28e83SPiotr Jasiukajtis /* 294*25c28e83SPiotr Jasiukajtis * for sin+cos->sincos transformation 295*25c28e83SPiotr Jasiukajtis */ 296*25c28e83SPiotr Jasiukajtis extern void sincos __P((double, double *, double *)); 297*25c28e83SPiotr Jasiukajtis extern void sincosf __P((float, float *, float *)); 298*25c28e83SPiotr Jasiukajtis extern void sincosl __P((long double, long double *, long double *)); 299*25c28e83SPiotr Jasiukajtis 300*25c28e83SPiotr Jasiukajtis #if defined(__MATHERR_ERRNO_DONTCARE) 301*25c28e83SPiotr Jasiukajtis #pragma does_not_read_global_data(sincos, sincosf, sincosl) 302*25c28e83SPiotr Jasiukajtis #endif 303*25c28e83SPiotr Jasiukajtis 304*25c28e83SPiotr Jasiukajtis /* BEGIN adopted by C99 */ 305*25c28e83SPiotr Jasiukajtis /* 306*25c28e83SPiotr Jasiukajtis * Functions callable from C, intended to support IEEE arithmetic. 307*25c28e83SPiotr Jasiukajtis */ 308*25c28e83SPiotr Jasiukajtis extern double copysign __P((double, double)); 309*25c28e83SPiotr Jasiukajtis extern double scalbn __P((double, int)); 310*25c28e83SPiotr Jasiukajtis 311*25c28e83SPiotr Jasiukajtis #if defined(__MATHERR_ERRNO_DONTCARE) 312*25c28e83SPiotr Jasiukajtis #pragma does_not_read_global_data(copysign, scalbn) 313*25c28e83SPiotr Jasiukajtis #pragma does_not_write_global_data(copysign, scalbn) 314*25c28e83SPiotr Jasiukajtis #pragma no_side_effect(copysign, scalbn) 315*25c28e83SPiotr Jasiukajtis #endif 316*25c28e83SPiotr Jasiukajtis /* END adopted by C99 */ 317*25c28e83SPiotr Jasiukajtis 318*25c28e83SPiotr Jasiukajtis /* 319*25c28e83SPiotr Jasiukajtis * Reentrant version of gamma & lgamma; passes signgam back by reference 320*25c28e83SPiotr Jasiukajtis * as the second argument; user must allocate space for signgam. 321*25c28e83SPiotr Jasiukajtis */ 322*25c28e83SPiotr Jasiukajtis extern double gamma_r __P((double, int *)); /* deprecated; use lgamma_r */ 323*25c28e83SPiotr Jasiukajtis extern double lgamma_r __P((double, int *)); 324*25c28e83SPiotr Jasiukajtis 325*25c28e83SPiotr Jasiukajtis #if defined(__MATHERR_ERRNO_DONTCARE) 326*25c28e83SPiotr Jasiukajtis #pragma does_not_read_global_data(gamma_r, lgamma_r) 327*25c28e83SPiotr Jasiukajtis #endif 328*25c28e83SPiotr Jasiukajtis 329*25c28e83SPiotr Jasiukajtis /* BEGIN adopted by C99 */ 330*25c28e83SPiotr Jasiukajtis extern float modff __P((float, float *)); 331*25c28e83SPiotr Jasiukajtis 332*25c28e83SPiotr Jasiukajtis #if defined(__MATHERR_ERRNO_DONTCARE) 333*25c28e83SPiotr Jasiukajtis #pragma does_not_read_global_data(modff) 334*25c28e83SPiotr Jasiukajtis #endif 335*25c28e83SPiotr Jasiukajtis /* END adopted by C99 */ 336*25c28e83SPiotr Jasiukajtis 337*25c28e83SPiotr Jasiukajtis #if defined(__EXTENSIONS__) || !defined(__cplusplus) 338*25c28e83SPiotr Jasiukajtis #include <floatingpoint.h> 339*25c28e83SPiotr Jasiukajtis #endif 340*25c28e83SPiotr Jasiukajtis #endif /* defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) */ 341*25c28e83SPiotr Jasiukajtis #endif /* defined(__EXTENSIONS__) || defined(_XOPEN_SOURCE) || ... */ 342*25c28e83SPiotr Jasiukajtis 343*25c28e83SPiotr Jasiukajtis #if defined(__cplusplus) && defined(__GNUC__) 344*25c28e83SPiotr Jasiukajtis #undef exception 345*25c28e83SPiotr Jasiukajtis #endif 346*25c28e83SPiotr Jasiukajtis 347*25c28e83SPiotr Jasiukajtis #ifdef __cplusplus 348*25c28e83SPiotr Jasiukajtis } 349*25c28e83SPiotr Jasiukajtis #endif 350*25c28e83SPiotr Jasiukajtis 351*25c28e83SPiotr Jasiukajtis #endif /* _MATH_H */ 352