|
|
|
| 1 |
|
/*** |
| 2 |
|
*math.h - definitions and declarations for math library |
| 3 |
|
* |
| 4 |
|
* Copyright (c) Microsoft Corporation. All rights reserved. |
| 5 |
|
* |
| 6 |
|
*Purpose: |
| 7 |
|
* This file contains constant definitions and external subroutine |
| 8 |
|
* declarations for the math subroutine library. |
| 9 |
|
* [ANSI/System V] |
| 10 |
|
* |
| 11 |
|
* [Public] |
| 12 |
|
* |
| 13 |
|
****/ |
| 14 |
|
|
| 15 |
|
#ifndef _INC_MATH |
| 16 |
|
#define _INC_MATH |
| 17 |
|
|
| 18 |
|
#include <crtdefs.h> |
| 19 |
|
|
| 20 |
|
#ifdef _MSC_VER |
| 21 |
|
/* |
| 22 |
|
* Currently, all MS C compilers for Win32 platforms default to 8 byte |
| 23 |
|
* alignment. |
| 24 |
|
*/ |
| 25 |
|
#pragma pack(push,_CRT_PACKING) |
| 26 |
|
#endif /* _MSC_VER */ |
| 27 |
|
|
| 28 |
|
#ifdef __cplusplus |
| 29 |
|
extern "C" { |
| 30 |
|
#endif |
| 31 |
|
|
| 32 |
|
#ifndef __assembler /* Protect from assembler */ |
| 33 |
|
|
| 34 |
|
/* Definition of _exception struct - this struct is passed to the matherr |
| 35 |
|
* routine when a floating point exception is detected |
| 36 |
|
*/ |
| 37 |
|
|
| 38 |
|
#ifndef _EXCEPTION_DEFINED |
| 39 |
|
struct _exception { |
| 40 |
|
int type; /* exception type - see below */ |
| 41 |
|
char *name; /* name of function where error occured */ |
| 42 |
|
double arg1; /* first argument to function */ |
| 43 |
|
double arg2; /* second argument (if any) to function */ |
| 44 |
|
double retval; /* value to be returned by function */ |
| 45 |
|
} ; |
| 46 |
|
|
| 47 |
|
#define _EXCEPTION_DEFINED |
| 48 |
|
#endif |
| 49 |
|
|
| 50 |
|
|
| 51 |
|
/* Definition of a _complex struct to be used by those who use cabs and |
| 52 |
|
* want type checking on their argument |
| 53 |
|
*/ |
| 54 |
|
|
| 55 |
|
#ifndef _COMPLEX_DEFINED |
| 56 |
|
struct _complex { |
| 57 |
|
double x,y; /* real and imaginary parts */ |
| 58 |
|
} ; |
| 59 |
|
|
| 60 |
|
#if !__STDC__ && !defined (__cplusplus) |
| 61 |
|
/* Non-ANSI name for compatibility */ |
| 62 |
|
#define complex _complex |
| 63 |
|
#endif |
| 64 |
|
|
| 65 |
|
#define _COMPLEX_DEFINED |
| 66 |
|
#endif |
| 67 |
|
#endif /* __assembler */ |
| 68 |
|
|
| 69 |
|
|
| 70 |
|
/* Constant definitions for the exception type passed in the _exception struct |
| 71 |
|
*/ |
| 72 |
|
|
| 73 |
|
#define _DOMAIN 1 /* argument domain error */ |
| 74 |
|
#define _SING 2 /* argument singularity */ |
| 75 |
|
#define _OVERFLOW 3 /* overflow range error */ |
| 76 |
|
#define _UNDERFLOW 4 /* underflow range error */ |
| 77 |
|
#define _TLOSS 5 /* total loss of precision */ |
| 78 |
|
#define _PLOSS 6 /* partial loss of precision */ |
| 79 |
|
|
| 80 |
|
#define EDOM 33 |
| 81 |
|
#define ERANGE 34 |
| 82 |
|
|
| 83 |
|
|
| 84 |
|
/* Definitions of _HUGE and HUGE_VAL - respectively the XENIX and ANSI names |
| 85 |
|
* for a value returned in case of error by a number of the floating point |
| 86 |
|
* math routines |
| 87 |
|
*/ |
| 88 |
|
#ifndef __assembler /* Protect from assembler */ |
| 89 |
|
#if !defined(_M_CEE_PURE) |
| 90 |
|
_CRTIMP extern double _HUGE; |
| 91 |
|
#else |
| 92 |
|
const double _HUGE = System::Double::PositiveInfinity; |
| 93 |
|
#endif /* !defined(_M_CEE_PURE) */ |
| 94 |
|
#endif /* __assembler */ |
| 95 |
|
|
| 96 |
|
#define HUGE_VAL _HUGE |
| 97 |
|
|
| 98 |
|
/* Function prototypes */ |
| 99 |
|
|
| 100 |
|
#if !defined(__assembler) /* Protect from assembler */ |
| 101 |
|
#ifndef _CRT_ABS_DEFINED |
| 102 |
|
#define _CRT_ABS_DEFINED |
| 103 |
|
int __cdecl abs(_In_ int _X); |
| 104 |
|
long __cdecl labs(_In_ long _X); |
| 105 |
|
#endif |
| 106 |
|
|
| 107 |
|
double __cdecl acos(_In_ double _X); |
| 108 |
|
double __cdecl asin(_In_ double _X); |
| 109 |
|
double __cdecl atan(_In_ double _X); |
| 110 |
|
double __cdecl atan2(_In_ double _Y, _In_ double _X); |
| 111 |
|
#ifndef _SIGN_DEFINED |
| 112 |
|
_Check_return_ _CRTIMP double __cdecl _copysign (_In_ double _Number, _In_ double _Sign); |
| 113 |
|
_Check_return_ _CRTIMP double __cdecl _chgsign (_In_ double _X); |
| 114 |
|
#define _SIGN_DEFINED |
| 115 |
|
#endif |
| 116 |
|
double __cdecl cos(_In_ double _X); |
| 117 |
|
double __cdecl cosh(_In_ double _X); |
| 118 |
|
double __cdecl exp(_In_ double _X); |
| 119 |
|
_CRT_JIT_INTRINSIC double __cdecl fabs(_In_ double _X); |
| 120 |
|
double __cdecl fmod(_In_ double _X, _In_ double _Y); |
| 121 |
|
double __cdecl log(_In_ double _X); |
| 122 |
|
double __cdecl log10(_In_ double _X); |
| 123 |
|
double __cdecl pow(_In_ double _X, _In_ double _Y); |
| 124 |
|
double __cdecl sin(_In_ double _X); |
| 125 |
|
double __cdecl sinh(_In_ double _X); |
| 126 |
|
double __cdecl tan(_In_ double _X); |
| 127 |
|
double __cdecl tanh(_In_ double _X); |
| 128 |
|
double __cdecl sqrt(_In_ double _X); |
| 129 |
|
#ifndef _CRT_ATOF_DEFINED |
| 130 |
|
#define _CRT_ATOF_DEFINED |
| 131 |
|
_Check_return_ _CRTIMP double __cdecl atof(_In_z_ const char *_String); |
| 132 |
|
_Check_return_ _CRTIMP double __cdecl _atof_l(_In_z_ const char *_String, _In_opt_ _locale_t _Locale); |
| 133 |
|
#endif |
| 134 |
|
|
| 135 |
|
_CRTIMP double __cdecl _cabs(_In_ struct _complex _Complex_value); |
| 136 |
|
_CRTIMP double __cdecl ceil(_In_ double _X); |
| 137 |
|
_CRTIMP double __cdecl floor(_In_ double _X); |
| 138 |
|
_CRTIMP double __cdecl frexp(_In_ double _X, _Out_ int * _Y); |
| 139 |
|
_CRTIMP double __cdecl _hypot(_In_ double _X, _In_ double _Y); |
| 140 |
|
_CRTIMP double __cdecl _j0(_In_ double _X ); |
| 141 |
|
_CRTIMP double __cdecl _j1(_In_ double _X ); |
| 142 |
|
_CRTIMP double __cdecl _jn(int _X, _In_ double _Y); |
| 143 |
|
_CRTIMP double __cdecl ldexp(_In_ double _X, _In_ int _Y); |
| 144 |
|
#ifndef _CRT_MATHERR_DEFINED |
| 145 |
|
#define _CRT_MATHERR_DEFINED |
| 146 |
|
#if defined(MRTDLL) || defined(_M_CEE_PURE) |
| 147 |
|
int __CRTDECL _matherr(_Inout_ struct _exception * _Except); |
| 148 |
|
#else |
| 149 |
|
int __cdecl _matherr(_Inout_ struct _exception * _Except); |
| 150 |
|
#endif |
| 151 |
|
#endif |
| 152 |
|
_CRTIMP double __cdecl modf(_In_ double _X, _Out_ double * _Y); |
| 153 |
|
|
| 154 |
|
_CRTIMP double __cdecl _y0(_In_ double _X); |
| 155 |
|
_CRTIMP double __cdecl _y1(_In_ double _X); |
| 156 |
|
_CRTIMP double __cdecl _yn(_In_ int _X, _In_ double _Y); |
| 157 |
|
|
| 158 |
|
|
| 159 |
|
#if defined(_M_IX86) |
| 160 |
|
|
| 161 |
|
_CRTIMP int __cdecl _set_SSE2_enable(_In_ int _Flag); |
| 162 |
|
_CRTIMP float __cdecl _hypotf(_In_ float _X, _In_ float _Y); |
| 163 |
|
|
| 164 |
|
#endif |
| 165 |
|
|
| 166 |
|
#if defined(_M_IA64) |
| 167 |
|
|
| 168 |
|
/* ANSI C, 4.5 Mathematics */ |
| 169 |
|
|
| 170 |
|
/* 4.5.2 Trigonometric functions */ |
| 171 |
|
|
| 172 |
|
_CRTIMP float __cdecl acosf( _In_ float _X); |
| 173 |
|
_CRTIMP float __cdecl asinf( _In_ float _X); |
| 174 |
|
_CRTIMP float __cdecl atanf( _In_ float _X); |
| 175 |
|
_CRTIMP float __cdecl atan2f( _In_ float _Y, float _X); |
| 176 |
|
_CRTIMP float __cdecl cosf( _In_ float _X); |
| 177 |
|
_CRTIMP float __cdecl sinf( _In_ float _X); |
| 178 |
|
_CRTIMP float __cdecl tanf( _In_ float _X); |
| 179 |
|
|
| 180 |
|
/* 4.5.3 Hyperbolic functions */ |
| 181 |
|
_CRTIMP float __cdecl coshf( _In_ float _X); |
| 182 |
|
_CRTIMP float __cdecl sinhf( _In_ float _X); |
| 183 |
|
_CRTIMP float __cdecl tanhf( _In_ float _X); |
| 184 |
|
|
| 185 |
|
/* 4.5.4 Exponential and logarithmic functions */ |
| 186 |
|
_CRTIMP float __cdecl expf( _In_ float _X); |
| 187 |
|
_CRTIMP float __cdecl logf( _In_ float _X); |
| 188 |
|
_CRTIMP float __cdecl log10f( _In_ float _X); |
| 189 |
|
_CRTIMP float __cdecl modff( float _X, _Out_ float* _Y); |
| 190 |
|
|
| 191 |
|
/* 4.5.5 Power functions */ |
| 192 |
|
_CRTIMP float __cdecl powf( _In_ float _Base, _In_ float _Exp); |
| 193 |
|
_CRTIMP float __cdecl sqrtf( _In_ float _X); |
| 194 |
|
|
| 195 |
|
/* 4.5.6 Nearest integer, absolute value, and remainder functions */ |
| 196 |
|
_CRTIMP float __cdecl ceilf( _In_ float _X); |
| 197 |
|
_CRT_JIT_INTRINSIC _CRTIMP float __cdecl fabsf( _In_ float _X); |
| 198 |
|
_CRTIMP float __cdecl floorf( _In_ float _X); |
| 199 |
|
_CRTIMP float __cdecl fmodf( _In_ float _X, _In_ float _Y); |
| 200 |
|
|
| 201 |
|
_CRTIMP float __cdecl _hypotf(_In_ float _X, _In_ float _Y); |
| 202 |
|
_CRTIMP float __cdecl ldexpf(_In_ float _X, _In_ int _Y); |
| 203 |
|
|
| 204 |
|
#endif /* _M_IA64 */ |
| 205 |
|
|
| 206 |
|
#if defined(_M_AMD64) |
| 207 |
|
|
| 208 |
|
/* ANSI C, 4.5 Mathematics */ |
| 209 |
|
|
| 210 |
|
/* 4.5.2 Trigonometric functions */ |
| 211 |
|
|
| 212 |
|
_CRTIMP float __cdecl acosf( _In_ float _X); |
| 213 |
|
_CRTIMP float __cdecl asinf( _In_ float _X); |
| 214 |
|
_CRTIMP float __cdecl atanf( _In_ float _X); |
| 215 |
|
_CRTIMP float __cdecl atan2f( _In_ float _Y, _In_ float _X); |
| 216 |
|
_CRTIMP float __cdecl cosf( _In_ float _X); |
| 217 |
|
_CRTIMP float __cdecl sinf( _In_ float _X); |
| 218 |
|
_CRTIMP float __cdecl tanf( _In_ float _X); |
| 219 |
|
|
| 220 |
|
/* 4.5.3 Hyperbolic functions */ |
| 221 |
|
_CRTIMP float __cdecl coshf( _In_ float _X); |
| 222 |
|
_CRTIMP float __cdecl sinhf( _In_ float _X); |
| 223 |
|
_CRTIMP float __cdecl tanhf( _In_ float _X); |
| 224 |
|
|
| 225 |
|
/* 4.5.4 Exponential and logarithmic functions */ |
| 226 |
|
_CRTIMP float __cdecl expf( _In_ float _X); |
| 227 |
|
_CRTIMP float __cdecl logf( _In_ float _X); |
| 228 |
|
_CRTIMP float __cdecl log10f( _In_ float _X); |
| 229 |
|
_CRTIMP float __cdecl modff( _In_ float _X, _Out_ float* _Y); |
| 230 |
|
|
| 231 |
|
/* 4.5.5 Power functions */ |
| 232 |
|
_CRTIMP float __cdecl powf( _In_ float _X, _In_ float _Y); |
| 233 |
|
_CRTIMP float __cdecl sqrtf( _In_ float _X); |
| 234 |
|
|
| 235 |
|
/* 4.5.6 Nearest integer, absolute value, and remainder functions */ |
| 236 |
|
_CRTIMP float __cdecl ceilf( _In_ float _X); |
| 237 |
|
_CRTIMP float __cdecl floorf( _In_ float _X); |
| 238 |
|
_CRTIMP float __cdecl fmodf( _In_ float _X, _In_ float _Y); |
| 239 |
|
|
| 240 |
|
_CRTIMP float __cdecl _hypotf(_In_ float _X, _In_ float _Y); |
| 241 |
|
|
| 242 |
|
_CRTIMP float __cdecl _copysignf (_In_ float _Number, _In_ float _Sign); |
| 243 |
|
_CRTIMP float __cdecl _chgsignf (_In_ float _X); |
| 244 |
|
_CRTIMP float __cdecl _logbf(_In_ float _X); |
| 245 |
|
_CRTIMP float __cdecl _nextafterf(_In_ float _X, _In_ float _Y); |
| 246 |
|
_CRTIMP int __cdecl _finitef(_In_ float _X); |
| 247 |
|
_CRTIMP int __cdecl _isnanf(_In_ float _X); |
| 248 |
|
_CRTIMP int __cdecl _fpclassf(_In_ float _X); |
| 249 |
|
|
| 250 |
|
#endif /* _M_AMD64 */ |
| 251 |
|
|
| 252 |
|
|
| 253 |
|
/* Macros defining long double functions to be their double counterparts |
| 254 |
|
* (long double is synonymous with double in this implementation). |
| 255 |
|
*/ |
| 256 |
|
|
| 257 |
|
#ifndef __cplusplus |
| 258 |
|
#define acosl(x) ((long double)acos((double)(x))) |
| 259 |
|
#define asinl(x) ((long double)asin((double)(x))) |
| 260 |
|
#define atanl(x) ((long double)atan((double)(x))) |
| 261 |
|
#define atan2l(y,x) ((long double)atan2((double)(y), (double)(x))) |
| 262 |
|
#define ceill(x) ((long double)ceil((double)(x))) |
| 263 |
|
#define cosl(x) ((long double)cos((double)(x))) |
| 264 |
|
#define coshl(x) ((long double)cosh((double)(x))) |
| 265 |
|
#define expl(x) ((long double)exp((double)(x))) |
| 266 |
|
#define fabsl(x) ((long double)fabs((double)(x))) |
| 267 |
|
#define floorl(x) ((long double)floor((double)(x))) |
| 268 |
|
#define fmodl(x,y) ((long double)fmod((double)(x), (double)(y))) |
| 269 |
|
#define frexpl(x,y) ((long double)frexp((double)(x), (y))) |
| 270 |
|
#define _hypotl(x,y) ((long double)_hypot((double)(x), (double)(y))) |
| 271 |
|
#define ldexpl(x,y) ((long double)ldexp((double)(x), (y))) |
| 272 |
|
#define logl(x) ((long double)log((double)(x))) |
| 273 |
|
#define log10l(x) ((long double)log10((double)(x))) |
| 274 |
|
#define _matherrl _matherr |
| 275 |
|
#define modfl(x,y) ((long double)modf((double)(x), (double *)(y))) |
| 276 |
|
#define powl(x,y) ((long double)pow((double)(x), (double)(y))) |
| 277 |
|
#define sinl(x) ((long double)sin((double)(x))) |
| 278 |
|
#define sinhl(x) ((long double)sinh((double)(x))) |
| 279 |
|
#define sqrtl(x) ((long double)sqrt((double)(x))) |
| 280 |
|
#define tanl(x) ((long double)tan((double)(x))) |
| 281 |
|
#define tanhl(x) ((long double)tanh((double)(x))) |
| 282 |
|
#define _chgsignl(x) ((long double)_chgsign((double)(x))) |
| 283 |
|
#define _copysignl(x,y) ((long double)_copysign((double)(x), (double)(y))) |
| 284 |
|
|
| 285 |
|
#define frexpf(x,y) ((float)frexp((double)(x),(y))) |
| 286 |
|
|
| 287 |
|
#if !defined (_M_IA64) |
| 288 |
|
#define fabsf(x) ((float)fabs((double)(x))) |
| 289 |
|
#define ldexpf(x,y) ((float)ldexp((double)(x),(y))) |
| 290 |
|
|
| 291 |
|
#if !defined (_M_AMD64) |
| 292 |
|
|
| 293 |
|
#define acosf(x) ((float)acos((double)(x))) |
| 294 |
|
#define asinf(x) ((float)asin((double)(x))) |
| 295 |
|
#define atanf(x) ((float)atan((double)(x))) |
| 296 |
|
#define atan2f(y,x) ((float)atan2((double)(y), (double)(x))) |
| 297 |
|
#define ceilf(x) ((float)ceil((double)(x))) |
| 298 |
|
#define cosf(x) ((float)cos((double)(x))) |
| 299 |
|
#define coshf(x) ((float)cosh((double)(x))) |
| 300 |
|
#define expf(x) ((float)exp((double)(x))) |
| 301 |
|
#define floorf(x) ((float)floor((double)(x))) |
| 302 |
|
#define fmodf(x,y) ((float)fmod((double)(x), (double)(y))) |
| 303 |
|
#define logf(x) ((float)log((double)(x))) |
| 304 |
|
#define log10f(x) ((float)log10((double)(x))) |
| 305 |
|
#define modff(x,y) ((float)modf((double)(x), (double *)(y))) |
| 306 |
|
#define powf(x,y) ((float)pow((double)(x), (double)(y))) |
| 307 |
|
#define sinf(x) ((float)sin((double)(x))) |
| 308 |
|
#define sinhf(x) ((float)sinh((double)(x))) |
| 309 |
|
#define sqrtf(x) ((float)sqrt((double)(x))) |
| 310 |
|
#define tanf(x) ((float)tan((double)(x))) |
| 311 |
|
#define tanhf(x) ((float)tanh((double)(x))) |
| 312 |
|
|
| 313 |
|
#endif /* !defined (_M_AMD64) */ |
| 314 |
|
#endif /* !defined (_M_IA64) */ |
| 315 |
|
|
| 316 |
|
#else /* __cplusplus */ |
| 317 |
|
inline long double acosl(_In_ long double _X) |
| 318 |
|
{return (acos((double)_X)); } |
| 319 |
|
inline long double asinl(_In_ long double _X) |
| 320 |
|
{return (asin((double)_X)); } |
| 321 |
|
inline long double atanl(_In_ long double _X) |
| 322 |
|
{return (atan((double)_X)); } |
| 323 |
|
inline long double atan2l(_In_ long double _Y, _In_ long double _X) |
| 324 |
|
{return (atan2((double)_Y, (double)_X)); } |
| 325 |
|
inline long double ceill(_In_ long double _X) |
| 326 |
|
{return (ceil((double)_X)); } |
| 327 |
|
inline long double cosl(_In_ long double _X) |
| 328 |
|
{return (cos((double)_X)); } |
| 329 |
|
inline long double coshl(_In_ long double _X) |
| 330 |
|
{return (cosh((double)_X)); } |
| 331 |
|
inline long double expl(_In_ long double _X) |
| 332 |
|
{return (exp((double)_X)); } |
| 333 |
|
inline long double fabsl(_In_ long double _X) |
| 334 |
|
{return (fabs((double)_X)); } |
| 335 |
|
inline long double floorl(_In_ long double _X) |
| 336 |
|
{return (floor((double)_X)); } |
| 337 |
|
inline long double fmodl(_In_ long double _X, _In_ long double _Y) |
| 338 |
|
{return (fmod((double)_X, (double)_Y)); } |
| 339 |
|
inline long double frexpl(_In_ long double _X, _Out_ int *_Y) |
| 340 |
|
{return (frexp((double)_X, _Y)); } |
| 341 |
|
inline long double ldexpl(_In_ long double _X, _In_ int _Y) |
| 342 |
|
{return (ldexp((double)_X, _Y)); } |
| 343 |
|
inline long double logl(_In_ long double _X) |
| 344 |
|
{return (log((double)_X)); } |
| 345 |
|
inline long double log10l(_In_ long double _X) |
| 346 |
|
{return (log10((double)_X)); } |
| 347 |
|
inline long double modfl(_In_ long double _X, _Out_ long double *_Y) |
| 348 |
|
{double _Di, _Df = modf((double)_X, &_Di); |
| 349 |
|
*_Y = (long double)_Di; |
| 350 |
|
return (_Df); } |
| 351 |
|
inline long double powl(_In_ long double _X, _In_ long double _Y) |
| 352 |
|
{return (pow((double)_X, (double)_Y)); } |
| 353 |
|
inline long double sinl(_In_ long double _X) |
| 354 |
|
{return (sin((double)_X)); } |
| 355 |
|
inline long double sinhl(_In_ long double _X) |
| 356 |
|
{return (sinh((double)_X)); } |
| 357 |
|
inline long double sqrtl(_In_ long double _X) |
| 358 |
|
{return (sqrt((double)_X)); } |
| 359 |
|
#ifndef _M_IA64 |
| 360 |
|
inline long double tanl(_In_ long double _X) |
| 361 |
|
{return (tan((double)_X)); } |
| 362 |
|
#else |
| 363 |
|
_CRTIMP long double __cdecl tanl(_In_ long double _X); |
| 364 |
|
#endif |
| 365 |
|
|
| 366 |
|
inline long double tanhl(_In_ long double _X) |
| 367 |
|
{return (tanh((double)_X)); } |
| 368 |
|
|
| 369 |
|
inline long double _chgsignl(_In_ long double _Number) |
| 370 |
|
{ |
| 371 |
|
return _chgsign(static_cast<double>(_Number)); |
| 372 |
|
} |
| 373 |
|
|
| 374 |
|
inline long double _copysignl(_In_ long double _Number, _In_ long double _Sign) |
| 375 |
|
{ |
| 376 |
|
return _copysign(static_cast<double>(_Number), static_cast<double>(_Sign)); |
| 377 |
|
} |
| 378 |
|
|
| 379 |
|
inline float frexpf(_In_ float _X, _Out_ int *_Y) |
| 380 |
|
{return ((float)frexp((double)_X, _Y)); } |
| 381 |
|
|
| 382 |
|
#if !defined(_M_IA64) |
| 383 |
|
inline float fabsf(_In_ float _X) |
| 384 |
|
{return ((float)fabs((double)_X)); } |
| 385 |
|
inline float ldexpf(_In_ float _X, _In_ int _Y) |
| 386 |
|
{return ((float)ldexp((double)_X, _Y)); } |
| 387 |
|
#if !defined(_M_AMD64) |
| 388 |
|
inline float acosf(_In_ float _X) |
| 389 |
|
{return ((float)acos((double)_X)); } |
| 390 |
|
inline float asinf(_In_ float _X) |
| 391 |
|
{return ((float)asin((double)_X)); } |
| 392 |
|
inline float atanf(_In_ float _X) |
| 393 |
|
{return ((float)atan((double)_X)); } |
| 394 |
|
inline float atan2f(_In_ float _Y, _In_ float _X) |
| 395 |
|
{return ((float)atan2((double)_Y, (double)_X)); } |
| 396 |
|
inline float ceilf(_In_ float _X) |
| 397 |
|
{return ((float)ceil((double)_X)); } |
| 398 |
|
inline float cosf(_In_ float _X) |
| 399 |
|
{return ((float)cos((double)_X)); } |
| 400 |
|
inline float coshf(_In_ float _X) |
| 401 |
|
{return ((float)cosh((double)_X)); } |
| 402 |
|
inline float expf(_In_ float _X) |
| 403 |
|
{return ((float)exp((double)_X)); } |
| 404 |
|
inline float floorf(_In_ float _X) |
| 405 |
|
{return ((float)floor((double)_X)); } |
| 406 |
|
inline float fmodf(_In_ float _X, _In_ float _Y) |
| 407 |
|
{return ((float)fmod((double)_X, (double)_Y)); } |
| 408 |
|
inline float logf(_In_ float _X) |
| 409 |
|
{return ((float)log((double)_X)); } |
| 410 |
|
inline float log10f(_In_ float _X) |
| 411 |
|
{return ((float)log10((double)_X)); } |
| 412 |
|
inline float modff(_In_ float _X, _Out_ float *_Y) |
| 413 |
|
{ double _Di, _Df = modf((double)_X, &_Di); |
| 414 |
|
*_Y = (float)_Di; |
| 415 |
|
return ((float)_Df); } |
| 416 |
|
inline float powf(_In_ float _X, _In_ float _Y) |
| 417 |
|
{return ((float)pow((double)_X, (double)_Y)); } |
| 418 |
|
inline float sinf(_In_ float _X) |
| 419 |
|
{return ((float)sin((double)_X)); } |
| 420 |
|
inline float sinhf(_In_ float _X) |
| 421 |
|
{return ((float)sinh((double)_X)); } |
| 422 |
|
inline float sqrtf(_In_ float _X) |
| 423 |
|
{return ((float)sqrt((double)_X)); } |
| 424 |
|
inline float tanf(_In_ float _X) |
| 425 |
|
{return ((float)tan((double)_X)); } |
| 426 |
|
inline float tanhf(_In_ float _X) |
| 427 |
|
{return ((float)tanh((double)_X)); } |
| 428 |
|
#endif /* !defined(_M_AMD64) */ |
| 429 |
|
#endif /* !defined(_M_IA64) */ |
| 430 |
|
#endif /* __cplusplus */ |
| 431 |
|
#endif /* __assembler */ |
| 432 |
|
|
| 433 |
|
#if !__STDC__ |
| 434 |
|
|
| 435 |
|
/* Non-ANSI names for compatibility */ |
| 436 |
|
|
| 437 |
|
#define DOMAIN _DOMAIN |
| 438 |
|
#define SING _SING |
| 439 |
|
#define OVERFLOW _OVERFLOW |
| 440 |
|
#define UNDERFLOW _UNDERFLOW |
| 441 |
|
#define TLOSS _TLOSS |
| 442 |
|
#define PLOSS _PLOSS |
| 443 |
|
|
| 444 |
|
#define matherr _matherr |
| 445 |
|
|
| 446 |
|
#ifndef __assembler /* Protect from assembler */ |
| 447 |
|
|
| 448 |
|
#if !defined(_M_CEE_PURE) |
| 449 |
|
_CRTIMP extern double HUGE; |
| 450 |
|
#else |
| 451 |
|
const double HUGE = _HUGE; |
| 452 |
|
#endif /* !defined(_M_CEE_PURE) */ |
| 453 |
|
|
| 454 |
|
_CRT_NONSTDC_DEPRECATE(_cabs) _CRTIMP double __cdecl cabs(_In_ struct _complex _X); |
| 455 |
|
_CRT_NONSTDC_DEPRECATE(_hypot) _CRTIMP double __cdecl hypot(_In_ double _X, _In_ double _Y); |
| 456 |
|
_CRT_NONSTDC_DEPRECATE(_j0) _CRTIMP double __cdecl j0(_In_ double _X); |
| 457 |
|
_CRT_NONSTDC_DEPRECATE(_j1) _CRTIMP double __cdecl j1(_In_ double _X); |
| 458 |
|
_CRT_NONSTDC_DEPRECATE(_jn) _CRTIMP double __cdecl jn(_In_ int _X, _In_ double _Y); |
| 459 |
|
_CRT_NONSTDC_DEPRECATE(_y0) _CRTIMP double __cdecl y0(_In_ double _X); |
| 460 |
|
_CRT_NONSTDC_DEPRECATE(_y1) _CRTIMP double __cdecl y1(_In_ double _X); |
| 461 |
|
_CRT_NONSTDC_DEPRECATE(_yn) _CRTIMP double __cdecl yn(_In_ int _X, _In_ double _Y); |
| 462 |
|
|
| 463 |
|
#endif /* __assembler */ |
| 464 |
|
|
| 465 |
|
#endif /* __STDC__ */ |
| 466 |
|
|
| 467 |
|
#ifdef __cplusplus |
| 468 |
|
} |
| 469 |
|
|
| 470 |
|
extern "C++" { |
| 471 |
|
|
| 472 |
|
template<class _Ty> inline |
| 473 |
|
_Ty _Pow_int(_Ty _X, int _Y) |
| 474 |
|
{unsigned int _N; |
| 475 |
|
if (_Y >= 0) |
| 476 |
|
_N = (unsigned int)_Y; |
| 477 |
|
else |
| 478 |
|
_N = (unsigned int)(-_Y); |
| 479 |
|
for (_Ty _Z = _Ty(1); ; _X *= _X) |
| 480 |
|
{if ((_N & 1) != 0) |
| 481 |
|
_Z *= _X; |
| 482 |
|
if ((_N >>= 1) == 0) |
| 483 |
|
return (_Y < 0 ? _Ty(1) / _Z : _Z); }} |
| 484 |
|
|
| 485 |
|
inline long __CRTDECL abs(_In_ long _X) |
| 486 |
|
{return (labs(_X)); } |
| 487 |
|
inline double __CRTDECL abs(_In_ double _X) |
| 488 |
|
{return (fabs(_X)); } |
| 489 |
|
inline double __CRTDECL pow(_In_ double _X, _In_ int _Y) |
| 490 |
|
{return (_Pow_int(_X, _Y)); } |
| 491 |
|
inline float __CRTDECL abs(_In_ float _X) |
| 492 |
|
{return (fabsf(_X)); } |
| 493 |
|
inline float __CRTDECL acos(_In_ float _X) |
| 494 |
|
{return (acosf(_X)); } |
| 495 |
|
inline float __CRTDECL asin(_In_ float _X) |
| 496 |
|
{return (asinf(_X)); } |
| 497 |
|
inline float __CRTDECL atan(_In_ float _X) |
| 498 |
|
{return (atanf(_X)); } |
| 499 |
|
inline float __CRTDECL atan2(_In_ float _Y, _In_ float _X) |
| 500 |
|
{return (atan2f(_Y, _X)); } |
| 501 |
|
inline float __CRTDECL ceil(_In_ float _X) |
| 502 |
|
{return (ceilf(_X)); } |
| 503 |
|
inline float __CRTDECL cos(_In_ float _X) |
| 504 |
|
{return (cosf(_X)); } |
| 505 |
|
inline float __CRTDECL cosh(_In_ float _X) |
| 506 |
|
{return (coshf(_X)); } |
| 507 |
|
inline float __CRTDECL exp(_In_ float _X) |
| 508 |
|
{return (expf(_X)); } |
| 509 |
|
inline float __CRTDECL fabs(_In_ float _X) |
| 510 |
|
{return (fabsf(_X)); } |
| 511 |
|
inline float __CRTDECL floor(_In_ float _X) |
| 512 |
|
{return (floorf(_X)); } |
| 513 |
|
inline float __CRTDECL fmod(_In_ float _X, _In_ float _Y) |
| 514 |
|
{return (fmodf(_X, _Y)); } |
| 515 |
|
inline float __CRTDECL frexp(_In_ float _X, _Out_ int * _Y) |
| 516 |
|
{return (frexpf(_X, _Y)); } |
| 517 |
|
inline float __CRTDECL ldexp(_In_ float _X, _In_ int _Y) |
| 518 |
|
{return (ldexpf(_X, _Y)); } |
| 519 |
|
inline float __CRTDECL log(_In_ float _X) |
| 520 |
|
{return (logf(_X)); } |
| 521 |
|
inline float __CRTDECL log10(_In_ float _X) |
| 522 |
|
{return (log10f(_X)); } |
| 523 |
|
inline float __CRTDECL modf(_In_ float _X, _Out_ float * _Y) |