Reactos
at master 1006 lines 38 kB view raw
1// 2// corecrt_math.h 3// 4// Copyright (c) Microsoft Corporation. All rights reserved. 5// 6// The majority of the C Standard Library <math.h> functionality. 7// 8#pragma once 9#ifndef _INC_MATH // include guard for 3rd party interop 10#define _INC_MATH 11 12#include <corecrt.h> 13 14#pragma warning(push) 15#pragma warning(disable: _UCRT_DISABLED_WARNINGS) 16_UCRT_DISABLE_CLANG_WARNINGS 17 18_CRT_BEGIN_C_HEADER 19 20#ifndef __assembler 21 // Definition of the _exception struct, which is passed to the matherr function 22 // when a floating point exception is detected: 23 struct _exception 24 { 25 int type; // exception type - see below 26 char* name; // name of function where error occurred 27 double arg1; // first argument to function 28 double arg2; // second argument (if any) to function 29 double retval; // value to be returned by function 30 }; 31 32 // Definition of the _complex struct to be used by those who use the complex 33 // functions and want type checking. 34 #ifndef _COMPLEX_DEFINED 35 #define _COMPLEX_DEFINED 36 37 struct _complex 38 { 39 double x, y; // real and imaginary parts 40 }; 41 42 #if defined(_CRT_INTERNAL_NONSTDC_NAMES) && _CRT_INTERNAL_NONSTDC_NAMES && !defined __cplusplus 43 // Non-ANSI name for compatibility 44 #define complex _complex 45 #endif 46 #endif 47#endif // __assembler 48 49 50 51// On x86, when not using /arch:SSE2 or greater, floating point operations 52// are performed using the x87 instruction set and FLT_EVAL_METHOD is 2. 53// (When /fp:fast is used, floating point operations may be consistent, so 54// we use the default types.) 55#if defined _M_IX86 && _M_IX86_FP < 2 && !defined _M_FP_FAST 56 typedef long double float_t; 57 typedef long double double_t; 58#else 59 typedef float float_t; 60 typedef double double_t; 61#endif 62 63 64 65// Constant definitions for the exception type passed in the _exception struct 66#define _DOMAIN 1 // argument domain error 67#define _SING 2 // argument singularity 68#define _OVERFLOW 3 // overflow range error 69#define _UNDERFLOW 4 // underflow range error 70#define _TLOSS 5 // total loss of precision 71#define _PLOSS 6 // partial loss of precision 72 73// Definitions of _HUGE and HUGE_VAL - respectively the XENIX and ANSI names 74// for a value returned in case of error by a number of the floating point 75// math routines. 76#ifndef __assembler 77 #ifndef _M_CEE_PURE 78 extern double const _HUGE; 79 #else 80 double const _HUGE = System::Double::PositiveInfinity; 81 #endif 82#endif 83 84#ifndef _HUGE_ENUF 85 #define _HUGE_ENUF 1e+300 // _HUGE_ENUF*_HUGE_ENUF must overflow 86#endif 87 88#define INFINITY ((float)(_HUGE_ENUF * _HUGE_ENUF)) 89#define HUGE_VAL ((double)INFINITY) 90#define HUGE_VALF ((float)INFINITY) 91#define HUGE_VALL ((long double)INFINITY) 92#ifndef _UCRT_NEGATIVE_NAN 93// This operation creates a negative NAN adding a - to make it positive 94#ifdef _MSC_VER 95#define NAN (-(float)(INFINITY * 0.0F)) 96#else 97#define NAN (__builtin_nanf("")) 98#endif 99#else 100// Keep this for backwards compatibility 101#ifdef _MSC_VER 102#define NAN ((float)(INFINITY * 0.0F)) 103#else 104#define NAN (-__builtin_nanf("")) 105#endif 106#endif 107 108#define _DENORM (-2) 109#define _FINITE (-1) 110#define _INFCODE 1 111#define _NANCODE 2 112 113#define FP_INFINITE _INFCODE 114#define FP_NAN _NANCODE 115#define FP_NORMAL _FINITE 116#define FP_SUBNORMAL _DENORM 117#define FP_ZERO 0 118 119#define _C2 1 // 0 if not 2's complement 120#define FP_ILOGB0 (-0x7fffffff - _C2) 121#define FP_ILOGBNAN 0x7fffffff 122 123#define MATH_ERRNO 1 124#define MATH_ERREXCEPT 2 125#define math_errhandling (MATH_ERRNO | MATH_ERREXCEPT) 126 127// Values for use as arguments to the _fperrraise function 128#define _FE_DIVBYZERO 0x04 129#define _FE_INEXACT 0x20 130#define _FE_INVALID 0x01 131#define _FE_OVERFLOW 0x08 132#define _FE_UNDERFLOW 0x10 133 134#define _D0_C 3 // little-endian, small long doubles 135#define _D1_C 2 136#define _D2_C 1 137#define _D3_C 0 138 139#define _DBIAS 0x3fe 140#define _DOFF 4 141 142#define _F0_C 1 // little-endian 143#define _F1_C 0 144 145#define _FBIAS 0x7e 146#define _FOFF 7 147#define _FRND 1 148 149#define _L0_C 3 // little-endian, 64-bit long doubles 150#define _L1_C 2 151#define _L2_C 1 152#define _L3_C 0 153 154#define _LBIAS 0x3fe 155#define _LOFF 4 156 157// IEEE 754 double properties 158#define _DFRAC ((unsigned short)((1 << _DOFF) - 1)) 159#define _DMASK ((unsigned short)(0x7fff & ~_DFRAC)) 160#define _DMAX ((unsigned short)((1 << (15 - _DOFF)) - 1)) 161#define _DSIGN ((unsigned short)0x8000) 162 163// IEEE 754 float properties 164#define _FFRAC ((unsigned short)((1 << _FOFF) - 1)) 165#define _FMASK ((unsigned short)(0x7fff & ~_FFRAC)) 166#define _FMAX ((unsigned short)((1 << (15 - _FOFF)) - 1)) 167#define _FSIGN ((unsigned short)0x8000) 168 169// IEEE 754 long double properties 170#define _LFRAC ((unsigned short)(-1)) 171#define _LMASK ((unsigned short)0x7fff) 172#define _LMAX ((unsigned short)0x7fff) 173#define _LSIGN ((unsigned short)0x8000) 174 175#define _DHUGE_EXP (int)(_DMAX * 900L / 1000) 176#define _FHUGE_EXP (int)(_FMAX * 900L / 1000) 177#define _LHUGE_EXP (int)(_LMAX * 900L / 1000) 178 179#define _DSIGN_C(_Val) (((_double_val *)(char*)&(_Val))->_Sh[_D0_C] & _DSIGN) 180#define _FSIGN_C(_Val) (((_float_val *)(char*)&(_Val))->_Sh[_F0_C] & _FSIGN) 181#define _LSIGN_C(_Val) (((_ldouble_val*)(char*)&(_Val))->_Sh[_L0_C] & _LSIGN) 182 183void __cdecl _fperrraise(_In_ int _Except); 184 185_Check_return_ _ACRTIMP short __cdecl _dclass(_In_ double _X); 186_Check_return_ _ACRTIMP short __cdecl _ldclass(_In_ long double _X); 187_Check_return_ _ACRTIMP short __cdecl _fdclass(_In_ float _X); 188 189_Check_return_ _ACRTIMP int __cdecl _dsign(_In_ double _X); 190_Check_return_ _ACRTIMP int __cdecl _ldsign(_In_ long double _X); 191_Check_return_ _ACRTIMP int __cdecl _fdsign(_In_ float _X); 192 193_Check_return_ _ACRTIMP int __cdecl _dpcomp(_In_ double _X, _In_ double _Y); 194_Check_return_ _ACRTIMP int __cdecl _ldpcomp(_In_ long double _X, _In_ long double _Y); 195_Check_return_ _ACRTIMP int __cdecl _fdpcomp(_In_ float _X, _In_ float _Y); 196 197_Check_return_ _ACRTIMP short __cdecl _dtest(_In_ double* _Px); 198_Check_return_ _ACRTIMP short __cdecl _ldtest(_In_ long double* _Px); 199_Check_return_ _ACRTIMP short __cdecl _fdtest(_In_ float* _Px); 200 201_ACRTIMP short __cdecl _d_int(_Inout_ double* _Px, _In_ short _Xexp); 202_ACRTIMP short __cdecl _ld_int(_Inout_ long double* _Px, _In_ short _Xexp); 203_ACRTIMP short __cdecl _fd_int(_Inout_ float* _Px, _In_ short _Xexp); 204 205_ACRTIMP short __cdecl _dscale(_Inout_ double* _Px, _In_ long _Lexp); 206_ACRTIMP short __cdecl _ldscale(_Inout_ long double* _Px, _In_ long _Lexp); 207_ACRTIMP short __cdecl _fdscale(_Inout_ float* _Px, _In_ long _Lexp); 208 209_ACRTIMP short __cdecl _dunscale(_Out_ short* _Pex, _Inout_ double* _Px); 210_ACRTIMP short __cdecl _ldunscale(_Out_ short* _Pex, _Inout_ long double* _Px); 211_ACRTIMP short __cdecl _fdunscale(_Out_ short* _Pex, _Inout_ float* _Px); 212 213_Check_return_ _ACRTIMP short __cdecl _dexp(_Inout_ double* _Px, _In_ double _Y, _In_ long _Eoff); 214_Check_return_ _ACRTIMP short __cdecl _ldexp(_Inout_ long double* _Px, _In_ long double _Y, _In_ long _Eoff); 215_Check_return_ _ACRTIMP short __cdecl _fdexp(_Inout_ float* _Px, _In_ float _Y, _In_ long _Eoff); 216 217_Check_return_ _ACRTIMP short __cdecl _dnorm(_Inout_updates_(4) unsigned short* _Ps); 218_Check_return_ _ACRTIMP short __cdecl _fdnorm(_Inout_updates_(2) unsigned short* _Ps); 219 220_Check_return_ _ACRTIMP double __cdecl _dpoly(_In_ double _X, _In_reads_(_N) double const* _Tab, _In_ int _N); 221_Check_return_ _ACRTIMP long double __cdecl _ldpoly(_In_ long double _X, _In_reads_(_N) long double const* _Tab, _In_ int _N); 222_Check_return_ _ACRTIMP float __cdecl _fdpoly(_In_ float _X, _In_reads_(_N) float const* _Tab, _In_ int _N); 223 224_Check_return_ _ACRTIMP double __cdecl _dlog(_In_ double _X, _In_ int _Baseflag); 225_Check_return_ _ACRTIMP long double __cdecl _ldlog(_In_ long double _X, _In_ int _Baseflag); 226_Check_return_ _ACRTIMP float __cdecl _fdlog(_In_ float _X, _In_ int _Baseflag); 227 228_Check_return_ _ACRTIMP double __cdecl _dsin(_In_ double _X, _In_ unsigned int _Qoff); 229_Check_return_ _ACRTIMP long double __cdecl _ldsin(_In_ long double _X, _In_ unsigned int _Qoff); 230_Check_return_ _ACRTIMP float __cdecl _fdsin(_In_ float _X, _In_ unsigned int _Qoff); 231 232// double declarations 233typedef union 234{ // pun floating type as integer array 235 unsigned short _Sh[4]; 236 double _Val; 237} _double_val; 238 239// float declarations 240typedef union 241{ // pun floating type as integer array 242 unsigned short _Sh[2]; 243 float _Val; 244} _float_val; 245 246// long double declarations 247typedef union 248{ // pun floating type as integer array 249 unsigned short _Sh[4]; 250 long double _Val; 251} _ldouble_val; 252 253typedef union 254{ // pun float types as integer array 255 unsigned short _Word[4]; 256 float _Float; 257 double _Double; 258 long double _Long_double; 259} _float_const; 260 261extern const _float_const _Denorm_C, _Inf_C, _Nan_C, _Snan_C, _Hugeval_C; 262extern const _float_const _FDenorm_C, _FInf_C, _FNan_C, _FSnan_C; 263extern const _float_const _LDenorm_C, _LInf_C, _LNan_C, _LSnan_C; 264 265extern const _float_const _Eps_C, _Rteps_C; 266extern const _float_const _FEps_C, _FRteps_C; 267extern const _float_const _LEps_C, _LRteps_C; 268 269extern const double _Zero_C, _Xbig_C; 270extern const float _FZero_C, _FXbig_C; 271extern const long double _LZero_C, _LXbig_C; 272 273#define _FP_LT 1 274#define _FP_EQ 2 275#define _FP_GT 4 276 277#ifndef __cplusplus 278 279 #define _CLASS_ARG(_Val) __pragma(warning(suppress:6334))(sizeof ((_Val) + (float)0) == sizeof (float) ? 'f' : sizeof ((_Val) + (double)0) == sizeof (double) ? 'd' : 'l') 280 #define _CLASSIFY(_Val, _FFunc, _DFunc, _LDFunc) (_CLASS_ARG(_Val) == 'f' ? _FFunc((float)(_Val)) : _CLASS_ARG(_Val) == 'd' ? _DFunc((double)(_Val)) : _LDFunc((long double)(_Val))) 281 #define _CLASSIFY2(_Val1, _Val2, _FFunc, _DFunc, _LDFunc) (_CLASS_ARG((_Val1) + (_Val2)) == 'f' ? _FFunc((float)(_Val1), (float)(_Val2)) : _CLASS_ARG((_Val1) + (_Val2)) == 'd' ? _DFunc((double)(_Val1), (double)(_Val2)) : _LDFunc((long double)(_Val1), (long double)(_Val2))) 282 283 #define fpclassify(_Val) (_CLASSIFY(_Val, _fdclass, _dclass, _ldclass)) 284 #define _FPCOMPARE(_Val1, _Val2) (_CLASSIFY2(_Val1, _Val2, _fdpcomp, _dpcomp, _ldpcomp)) 285 286 #define isfinite(_Val) (fpclassify(_Val) <= 0) 287 #define isinf(_Val) (fpclassify(_Val) == FP_INFINITE) 288 #define isnan(_Val) (fpclassify(_Val) == FP_NAN) 289 #define isnormal(_Val) (fpclassify(_Val) == FP_NORMAL) 290 #define signbit(_Val) (_CLASSIFY(_Val, _fdsign, _dsign, _ldsign)) 291 292 #define isgreater(x, y) ((_FPCOMPARE(x, y) & _FP_GT) != 0) 293 #define isgreaterequal(x, y) ((_FPCOMPARE(x, y) & (_FP_EQ | _FP_GT)) != 0) 294 #define isless(x, y) ((_FPCOMPARE(x, y) & _FP_LT) != 0) 295 #define islessequal(x, y) ((_FPCOMPARE(x, y) & (_FP_LT | _FP_EQ)) != 0) 296 #define islessgreater(x, y) ((_FPCOMPARE(x, y) & (_FP_LT | _FP_GT)) != 0) 297 #define isunordered(x, y) (_FPCOMPARE(x, y) == 0) 298 299#else // __cplusplus 300extern "C++" 301{ 302 _Check_return_ inline int fpclassify(_In_ float _X) throw() 303 { 304 return _fdtest(&_X); 305 } 306 307 _Check_return_ inline int fpclassify(_In_ double _X) throw() 308 { 309 return _dtest(&_X); 310 } 311 312 _Check_return_ inline int fpclassify(_In_ long double _X) throw() 313 { 314 return _ldtest(&_X); 315 } 316 317 _Check_return_ inline bool signbit(_In_ float _X) throw() 318 { 319 return _fdsign(_X) != 0; 320 } 321 322 _Check_return_ inline bool signbit(_In_ double _X) throw() 323 { 324 return _dsign(_X) != 0; 325 } 326 327 _Check_return_ inline bool signbit(_In_ long double _X) throw() 328 { 329 return _ldsign(_X) != 0; 330 } 331 332 _Check_return_ inline int _fpcomp(_In_ float _X, _In_ float _Y) throw() 333 { 334 return _fdpcomp(_X, _Y); 335 } 336 337 _Check_return_ inline int _fpcomp(_In_ double _X, _In_ double _Y) throw() 338 { 339 return _dpcomp(_X, _Y); 340 } 341 342 _Check_return_ inline int _fpcomp(_In_ long double _X, _In_ long double _Y) throw() 343 { 344 return _ldpcomp(_X, _Y); 345 } 346 347 template <class _Trc, class _Tre> struct _Combined_type 348 { // determine combined type 349 typedef float _Type; 350 }; 351 352 template <> struct _Combined_type<float, double> 353 { // determine combined type 354 typedef double _Type; 355 }; 356 357 template <> struct _Combined_type<float, long double> 358 { // determine combined type 359 typedef long double _Type; 360 }; 361 362 template <class _Ty, class _T2> struct _Real_widened 363 { // determine widened real type 364 typedef long double _Type; 365 }; 366 367 template <> struct _Real_widened<float, float> 368 { // determine widened real type 369 typedef float _Type; 370 }; 371 372 template <> struct _Real_widened<float, double> 373 { // determine widened real type 374 typedef double _Type; 375 }; 376 377 template <> struct _Real_widened<double, float> 378 { // determine widened real type 379 typedef double _Type; 380 }; 381 382 template <> struct _Real_widened<double, double> 383 { // determine widened real type 384 typedef double _Type; 385 }; 386 387 template <class _Ty> struct _Real_type 388 { // determine equivalent real type 389 typedef double _Type; // default is double 390 }; 391 392 template <> struct _Real_type<float> 393 { // determine equivalent real type 394 typedef float _Type; 395 }; 396 397 template <> struct _Real_type<long double> 398 { // determine equivalent real type 399 typedef long double _Type; 400 }; 401 402 template <class _T1, class _T2> 403 _Check_return_ inline int _fpcomp(_In_ _T1 _X, _In_ _T2 _Y) throw() 404 { // compare _Left and _Right 405 typedef typename _Combined_type<float, 406 typename _Real_widened< 407 typename _Real_type<_T1>::_Type, 408 typename _Real_type<_T2>::_Type>::_Type>::_Type _Tw; 409 return _fpcomp((_Tw)_X, (_Tw)_Y); 410 } 411 412 template <class _Ty> 413 _Check_return_ inline bool isfinite(_In_ _Ty _X) throw() 414 { 415 return fpclassify(_X) <= 0; 416 } 417 418 template <class _Ty> 419 _Check_return_ inline bool isinf(_In_ _Ty _X) throw() 420 { 421 return fpclassify(_X) == FP_INFINITE; 422 } 423 424 template <class _Ty> 425 _Check_return_ inline bool isnan(_In_ _Ty _X) throw() 426 { 427 return fpclassify(_X) == FP_NAN; 428 } 429 430 template <class _Ty> 431 _Check_return_ inline bool isnormal(_In_ _Ty _X) throw() 432 { 433 return fpclassify(_X) == FP_NORMAL; 434 } 435 436 template <class _Ty1, class _Ty2> 437 _Check_return_ inline bool isgreater(_In_ _Ty1 _X, _In_ _Ty2 _Y) throw() 438 { 439 return (_fpcomp(_X, _Y) & _FP_GT) != 0; 440 } 441 442 template <class _Ty1, class _Ty2> 443 _Check_return_ inline bool isgreaterequal(_In_ _Ty1 _X, _In_ _Ty2 _Y) throw() 444 { 445 return (_fpcomp(_X, _Y) & (_FP_EQ | _FP_GT)) != 0; 446 } 447 448 template <class _Ty1, class _Ty2> 449 _Check_return_ inline bool isless(_In_ _Ty1 _X, _In_ _Ty2 _Y) throw() 450 { 451 return (_fpcomp(_X, _Y) & _FP_LT) != 0; 452 } 453 454 template <class _Ty1, class _Ty2> 455 _Check_return_ inline bool islessequal(_In_ _Ty1 _X, _In_ _Ty2 _Y) throw() 456 { 457 return (_fpcomp(_X, _Y) & (_FP_LT | _FP_EQ)) != 0; 458 } 459 460 template <class _Ty1, class _Ty2> 461 _Check_return_ inline bool islessgreater(_In_ _Ty1 _X, _In_ _Ty2 _Y) throw() 462 { 463 return (_fpcomp(_X, _Y) & (_FP_LT | _FP_GT)) != 0; 464 } 465 466 template <class _Ty1, class _Ty2> 467 _Check_return_ inline bool isunordered(_In_ _Ty1 _X, _In_ _Ty2 _Y) throw() 468 { 469 return _fpcomp(_X, _Y) == 0; 470 } 471} // extern "C++" 472#endif // __cplusplus 473 474 475 476#if _CRT_FUNCTIONS_REQUIRED 477 478 _Check_return_ int __cdecl abs(_In_ int _X); 479 _Check_return_ long __cdecl labs(_In_ long _X); 480 _Check_return_ long long __cdecl llabs(_In_ long long _X); 481 482 _Check_return_ double __cdecl acos(_In_ double _X); 483 _Check_return_ double __cdecl asin(_In_ double _X); 484 _Check_return_ double __cdecl atan(_In_ double _X); 485 _Check_return_ double __cdecl atan2(_In_ double _Y, _In_ double _X); 486 487 _Check_return_ double __cdecl cos(_In_ double _X); 488 _Check_return_ double __cdecl cosh(_In_ double _X); 489 _Check_return_ double __cdecl exp(_In_ double _X); 490 _Check_return_ _CRT_JIT_INTRINSIC double __cdecl fabs(_In_ double _X); 491 _Check_return_ double __cdecl fmod(_In_ double _X, _In_ double _Y); 492 _Check_return_ double __cdecl log(_In_ double _X); 493 _Check_return_ double __cdecl log10(_In_ double _X); 494 _Check_return_ double __cdecl pow(_In_ double _X, _In_ double _Y); 495 _Check_return_ double __cdecl sin(_In_ double _X); 496 _Check_return_ double __cdecl sinh(_In_ double _X); 497 _Check_return_ _CRT_JIT_INTRINSIC double __cdecl sqrt(_In_ double _X); 498 _Check_return_ double __cdecl tan(_In_ double _X); 499 _Check_return_ double __cdecl tanh(_In_ double _X); 500 501 _Check_return_ _ACRTIMP double __cdecl acosh(_In_ double _X); 502 _Check_return_ _ACRTIMP double __cdecl asinh(_In_ double _X); 503 _Check_return_ _ACRTIMP double __cdecl atanh(_In_ double _X); 504 _Check_return_ _ACRTIMP double __cdecl atof(_In_z_ char const* _String); 505 _Check_return_ _ACRTIMP double __cdecl _atof_l(_In_z_ char const* _String, _In_opt_ _locale_t _Locale); 506 _Check_return_ _ACRTIMP double __cdecl _cabs(_In_ struct _complex _Complex_value); 507 _Check_return_ _ACRTIMP double __cdecl cbrt(_In_ double _X); 508 _Check_return_ _ACRTIMP double __cdecl ceil(_In_ double _X); 509 _Check_return_ _ACRTIMP double __cdecl _chgsign(_In_ double _X); 510 _Check_return_ _ACRTIMP double __cdecl copysign(_In_ double _Number, _In_ double _Sign); 511 _Check_return_ _ACRTIMP double __cdecl _copysign(_In_ double _Number, _In_ double _Sign); 512 _Check_return_ _ACRTIMP double __cdecl erf(_In_ double _X); 513 _Check_return_ _ACRTIMP double __cdecl erfc(_In_ double _X); 514 _Check_return_ _ACRTIMP double __cdecl exp2(_In_ double _X); 515 _Check_return_ _ACRTIMP double __cdecl expm1(_In_ double _X); 516 _Check_return_ _ACRTIMP double __cdecl fdim(_In_ double _X, _In_ double _Y); 517 _Check_return_ _ACRTIMP double __cdecl floor(_In_ double _X); 518 _Check_return_ _ACRTIMP double __cdecl fma(_In_ double _X, _In_ double _Y, _In_ double _Z); 519 _Check_return_ _ACRTIMP double __cdecl fmax(_In_ double _X, _In_ double _Y); 520 _Check_return_ _ACRTIMP double __cdecl fmin(_In_ double _X, _In_ double _Y); 521 _Check_return_ _ACRTIMP double __cdecl frexp(_In_ double _X, _Out_ int* _Y); 522 _Check_return_ _ACRTIMP double __cdecl hypot(_In_ double _X, _In_ double _Y); 523 _Check_return_ _ACRTIMP double __cdecl _hypot(_In_ double _X, _In_ double _Y); 524 _Check_return_ _ACRTIMP int __cdecl ilogb(_In_ double _X); 525 _Check_return_ _ACRTIMP double __cdecl ldexp(_In_ double _X, _In_ int _Y); 526 _Check_return_ _ACRTIMP double __cdecl lgamma(_In_ double _X); 527 _Check_return_ _ACRTIMP long long __cdecl llrint(_In_ double _X); 528 _Check_return_ _ACRTIMP long long __cdecl llround(_In_ double _X); 529 _Check_return_ _ACRTIMP double __cdecl log1p(_In_ double _X); 530 _Check_return_ _ACRTIMP double __cdecl log2(_In_ double _X); 531 _Check_return_ _ACRTIMP double __cdecl logb(_In_ double _X); 532 _Check_return_ _ACRTIMP long __cdecl lrint(_In_ double _X); 533 _Check_return_ _ACRTIMP long __cdecl lround(_In_ double _X); 534 535 int __CRTDECL _matherr(_Inout_ struct _exception* _Except); 536 537 _Check_return_ _ACRTIMP double __cdecl modf(_In_ double _X, _Out_ double* _Y); 538 _Check_return_ _ACRTIMP double __cdecl nan(_In_ char const* _X); 539 _Check_return_ _ACRTIMP double __cdecl nearbyint(_In_ double _X); 540 _Check_return_ _ACRTIMP double __cdecl nextafter(_In_ double _X, _In_ double _Y); 541 _Check_return_ _ACRTIMP double __cdecl nexttoward(_In_ double _X, _In_ long double _Y); 542 _Check_return_ _ACRTIMP double __cdecl remainder(_In_ double _X, _In_ double _Y); 543 _Check_return_ _ACRTIMP double __cdecl remquo(_In_ double _X, _In_ double _Y, _Out_ int* _Z); 544 _Check_return_ _ACRTIMP double __cdecl rint(_In_ double _X); 545 _Check_return_ _ACRTIMP double __cdecl round(_In_ double _X); 546 _Check_return_ _ACRTIMP double __cdecl scalbln(_In_ double _X, _In_ long _Y); 547 _Check_return_ _ACRTIMP double __cdecl scalbn(_In_ double _X, _In_ int _Y); 548 _Check_return_ _ACRTIMP double __cdecl tgamma(_In_ double _X); 549 _Check_return_ _ACRTIMP double __cdecl trunc(_In_ double _X); 550 _Check_return_ _ACRTIMP double __cdecl _j0(_In_ double _X ); 551 _Check_return_ _ACRTIMP double __cdecl _j1(_In_ double _X ); 552 _Check_return_ _ACRTIMP double __cdecl _jn(int _X, _In_ double _Y); 553 _Check_return_ _ACRTIMP double __cdecl _y0(_In_ double _X); 554 _Check_return_ _ACRTIMP double __cdecl _y1(_In_ double _X); 555 _Check_return_ _ACRTIMP double __cdecl _yn(_In_ int _X, _In_ double _Y); 556 557 _Check_return_ _ACRTIMP float __cdecl acoshf(_In_ float _X); 558 _Check_return_ _ACRTIMP float __cdecl asinhf(_In_ float _X); 559 _Check_return_ _ACRTIMP float __cdecl atanhf(_In_ float _X); 560 _Check_return_ _ACRTIMP float __cdecl cbrtf(_In_ float _X); 561 _Check_return_ _ACRTIMP float __cdecl _chgsignf(_In_ float _X); 562 _Check_return_ _ACRTIMP float __cdecl copysignf(_In_ float _Number, _In_ float _Sign); 563 _Check_return_ _ACRTIMP float __cdecl _copysignf(_In_ float _Number, _In_ float _Sign); 564 _Check_return_ _ACRTIMP float __cdecl erff(_In_ float _X); 565 _Check_return_ _ACRTIMP float __cdecl erfcf(_In_ float _X); 566 _Check_return_ _ACRTIMP float __cdecl expm1f(_In_ float _X); 567 _Check_return_ _ACRTIMP float __cdecl exp2f(_In_ float _X); 568 _Check_return_ _ACRTIMP float __cdecl fdimf(_In_ float _X, _In_ float _Y); 569 _Check_return_ _ACRTIMP float __cdecl fmaf(_In_ float _X, _In_ float _Y, _In_ float _Z); 570 _Check_return_ _ACRTIMP float __cdecl fmaxf(_In_ float _X, _In_ float _Y); 571 _Check_return_ _ACRTIMP float __cdecl fminf(_In_ float _X, _In_ float _Y); 572 _Check_return_ _ACRTIMP float __cdecl _hypotf(_In_ float _X, _In_ float _Y); 573 _Check_return_ _ACRTIMP int __cdecl ilogbf(_In_ float _X); 574 _Check_return_ _ACRTIMP float __cdecl lgammaf(_In_ float _X); 575 _Check_return_ _ACRTIMP long long __cdecl llrintf(_In_ float _X); 576 _Check_return_ _ACRTIMP long long __cdecl llroundf(_In_ float _X); 577 _Check_return_ _ACRTIMP float __cdecl log1pf(_In_ float _X); 578 _Check_return_ _ACRTIMP float __cdecl log2f(_In_ float _X); 579 _Check_return_ _ACRTIMP float __cdecl logbf(_In_ float _X); 580 _Check_return_ _ACRTIMP long __cdecl lrintf(_In_ float _X); 581 _Check_return_ _ACRTIMP long __cdecl lroundf(_In_ float _X); 582 _Check_return_ _ACRTIMP float __cdecl nanf(_In_ char const* _X); 583 _Check_return_ _ACRTIMP float __cdecl nearbyintf(_In_ float _X); 584 _Check_return_ _ACRTIMP float __cdecl nextafterf(_In_ float _X, _In_ float _Y); 585 _Check_return_ _ACRTIMP float __cdecl nexttowardf(_In_ float _X, _In_ long double _Y); 586 _Check_return_ _ACRTIMP float __cdecl remainderf(_In_ float _X, _In_ float _Y); 587 _Check_return_ _ACRTIMP float __cdecl remquof(_In_ float _X, _In_ float _Y, _Out_ int* _Z); 588 _Check_return_ _ACRTIMP float __cdecl rintf(_In_ float _X); 589 _Check_return_ _ACRTIMP float __cdecl roundf(_In_ float _X); 590 _Check_return_ _ACRTIMP float __cdecl scalblnf(_In_ float _X, _In_ long _Y); 591 _Check_return_ _ACRTIMP float __cdecl scalbnf(_In_ float _X, _In_ int _Y); 592 _Check_return_ _ACRTIMP float __cdecl tgammaf(_In_ float _X); 593 _Check_return_ _ACRTIMP float __cdecl truncf(_In_ float _X); 594 595 #if defined _M_IX86 596 597 _Check_return_ _ACRTIMP int __cdecl _set_SSE2_enable(_In_ int _Flag); 598 599 #endif 600 601 #if defined _M_X64 602 603 _Check_return_ _ACRTIMP float __cdecl _logbf(_In_ float _X); 604 _Check_return_ _ACRTIMP float __cdecl _nextafterf(_In_ float _X, _In_ float _Y); 605 _Check_return_ _ACRTIMP int __cdecl _finitef(_In_ float _X); 606 _Check_return_ _ACRTIMP int __cdecl _isnanf(_In_ float _X); 607 _Check_return_ _ACRTIMP int __cdecl _fpclassf(_In_ float _X); 608 609 _Check_return_ _ACRTIMP int __cdecl _set_FMA3_enable(_In_ int _Flag); 610 _Check_return_ _ACRTIMP int __cdecl _get_FMA3_enable(void); 611 612 #elif defined _M_ARM || defined _M_ARM64 || defined _M_HYBRID_X86_ARM64 613 614 _Check_return_ _ACRTIMP int __cdecl _finitef(_In_ float _X); 615 _Check_return_ _ACRTIMP float __cdecl _logbf(_In_ float _X); 616 617 #endif 618 619 620 621 #if defined _M_X64 || defined _M_ARM || defined _M_ARM64 || defined _M_HYBRID_X86_ARM64 || defined _CORECRT_BUILD_APISET || defined _M_ARM64EC 622 623 _Check_return_ _ACRTIMP float __cdecl acosf(_In_ float _X); 624 _Check_return_ _ACRTIMP float __cdecl asinf(_In_ float _X); 625 _Check_return_ _ACRTIMP float __cdecl atan2f(_In_ float _Y, _In_ float _X); 626 _Check_return_ _ACRTIMP float __cdecl atanf(_In_ float _X); 627 _Check_return_ _ACRTIMP float __cdecl ceilf(_In_ float _X); 628 _Check_return_ _ACRTIMP float __cdecl cosf(_In_ float _X); 629 _Check_return_ _ACRTIMP float __cdecl coshf(_In_ float _X); 630 _Check_return_ _ACRTIMP float __cdecl expf(_In_ float _X); 631 632 #else 633 634 _Check_return_ __inline float __CRTDECL acosf(_In_ float _X) 635 { 636 return (float)acos(_X); 637 } 638 639 _Check_return_ __inline float __CRTDECL asinf(_In_ float _X) 640 { 641 return (float)asin(_X); 642 } 643 644 _Check_return_ __inline float __CRTDECL atan2f(_In_ float _Y, _In_ float _X) 645 { 646 return (float)atan2(_Y, _X); 647 } 648 649 _Check_return_ __inline float __CRTDECL atanf(_In_ float _X) 650 { 651 return (float)atan(_X); 652 } 653 654 _Check_return_ __inline float __CRTDECL ceilf(_In_ float _X) 655 { 656 return (float)ceil(_X); 657 } 658 659 _Check_return_ __inline float __CRTDECL cosf(_In_ float _X) 660 { 661 return (float)cos(_X); 662 } 663 664 _Check_return_ __inline float __CRTDECL coshf(_In_ float _X) 665 { 666 return (float)cosh(_X); 667 } 668 669 _Check_return_ __inline float __CRTDECL expf(_In_ float _X) 670 { 671 return (float)exp(_X); 672 } 673 674 #endif 675 676 #if defined _M_ARM || defined _M_ARM64 || defined _M_HYBRID_X86_ARM64 || defined _M_ARM64EC 677 678 _Check_return_ _CRT_JIT_INTRINSIC _ACRTIMP float __cdecl fabsf(_In_ float _X); 679 680 #else 681 682 _Check_return_ __inline float __CRTDECL fabsf(_In_ float _X) 683 { 684 return (float)fabs(_X); 685 } 686 687 #endif 688 689 #if defined _M_X64 || defined _M_ARM || defined _M_ARM64 || defined _M_HYBRID_X86_ARM64 || defined _M_ARM64EC 690 691 _Check_return_ _ACRTIMP float __cdecl floorf(_In_ float _X); 692 _Check_return_ _ACRTIMP float __cdecl fmodf(_In_ float _X, _In_ float _Y); 693 694 #else 695 696 _Check_return_ __inline float __CRTDECL floorf(_In_ float _X) 697 { 698 return (float)floor(_X); 699 } 700 701 _Check_return_ __inline float __CRTDECL fmodf(_In_ float _X, _In_ float _Y) 702 { 703 return (float)fmod(_X, _Y); 704 } 705 706 #endif 707 708 _Check_return_ __inline float __CRTDECL frexpf(_In_ float _X, _Out_ int *_Y) 709 { 710 return (float)frexp(_X, _Y); 711 } 712 713 _Check_return_ __inline float __CRTDECL hypotf(_In_ float _X, _In_ float _Y) 714 { 715 return _hypotf(_X, _Y); 716 } 717 718 _Check_return_ __inline float __CRTDECL ldexpf(_In_ float _X, _In_ int _Y) 719 { 720 return (float)ldexp(_X, _Y); 721 } 722 723 #if defined _M_X64 || defined _M_ARM || defined _M_ARM64 || defined _M_HYBRID_X86_ARM64 || defined _CORECRT_BUILD_APISET || defined _M_ARM64EC 724 725 _Check_return_ _ACRTIMP float __cdecl log10f(_In_ float _X); 726 _Check_return_ _ACRTIMP float __cdecl logf(_In_ float _X); 727 _Check_return_ _ACRTIMP float __cdecl modff(_In_ float _X, _Out_ float *_Y); 728 _Check_return_ _ACRTIMP float __cdecl powf(_In_ float _X, _In_ float _Y); 729 _Check_return_ _ACRTIMP float __cdecl sinf(_In_ float _X); 730 _Check_return_ _ACRTIMP float __cdecl sinhf(_In_ float _X); 731 _Check_return_ _ACRTIMP float __cdecl sqrtf(_In_ float _X); 732 _Check_return_ _ACRTIMP float __cdecl tanf(_In_ float _X); 733 _Check_return_ _ACRTIMP float __cdecl tanhf(_In_ float _X); 734 735 #else 736 737 _Check_return_ __inline float __CRTDECL log10f(_In_ float _X) 738 { 739 return (float)log10(_X); 740 } 741 742 _Check_return_ __inline float __CRTDECL logf(_In_ float _X) 743 { 744 return (float)log(_X); 745 } 746 747 _Check_return_ __inline float __CRTDECL modff(_In_ float _X, _Out_ float* _Y) 748 { 749 double _F, _I; 750 _F = modf(_X, &_I); 751 *_Y = (float)_I; 752 return (float)_F; 753 } 754 755 _Check_return_ __inline float __CRTDECL powf(_In_ float _X, _In_ float _Y) 756 { 757 return (float)pow(_X, _Y); 758 } 759 760 _Check_return_ __inline float __CRTDECL sinf(_In_ float _X) 761 { 762 return (float)sin(_X); 763 } 764 765 _Check_return_ __inline float __CRTDECL sinhf(_In_ float _X) 766 { 767 return (float)sinh(_X); 768 } 769 770 _Check_return_ __inline float __CRTDECL sqrtf(_In_ float _X) 771 { 772 return (float)sqrt(_X); 773 } 774 775 _Check_return_ __inline float __CRTDECL tanf(_In_ float _X) 776 { 777 return (float)tan(_X); 778 } 779 780 _Check_return_ __inline float __CRTDECL tanhf(_In_ float _X) 781 { 782 return (float)tanh(_X); 783 } 784 785 #endif 786 787 _Check_return_ _ACRTIMP long double __cdecl acoshl(_In_ long double _X); 788 789 _Check_return_ __inline long double __CRTDECL acosl(_In_ long double _X) 790 { 791 return acos((double)_X); 792 } 793 794 _Check_return_ _ACRTIMP long double __cdecl asinhl(_In_ long double _X); 795 796 _Check_return_ __inline long double __CRTDECL asinl(_In_ long double _X) 797 { 798 return asin((double)_X); 799 } 800 801 _Check_return_ __inline long double __CRTDECL atan2l(_In_ long double _Y, _In_ long double _X) 802 { 803 return atan2((double)_Y, (double)_X); 804 } 805 806 _Check_return_ _ACRTIMP long double __cdecl atanhl(_In_ long double _X); 807 808 _Check_return_ __inline long double __CRTDECL atanl(_In_ long double _X) 809 { 810 return atan((double)_X); 811 } 812 813 _Check_return_ _ACRTIMP long double __cdecl cbrtl(_In_ long double _X); 814 815 _Check_return_ __inline long double __CRTDECL ceill(_In_ long double _X) 816 { 817 return ceil((double)_X); 818 } 819 820 _Check_return_ __inline long double __CRTDECL _chgsignl(_In_ long double _X) 821 { 822 return _chgsign((double)_X); 823 } 824 825 _Check_return_ _ACRTIMP long double __cdecl copysignl(_In_ long double _Number, _In_ long double _Sign); 826 827 _Check_return_ __inline long double __CRTDECL _copysignl(_In_ long double _Number, _In_ long double _Sign) 828 { 829 return _copysign((double)_Number, (double)_Sign); 830 } 831 832 _Check_return_ __inline long double __CRTDECL coshl(_In_ long double _X) 833 { 834 return cosh((double)_X); 835 } 836 837 _Check_return_ __inline long double __CRTDECL cosl(_In_ long double _X) 838 { 839 return cos((double)_X); 840 } 841 842 _Check_return_ _ACRTIMP long double __cdecl erfl(_In_ long double _X); 843 _Check_return_ _ACRTIMP long double __cdecl erfcl(_In_ long double _X); 844 845 _Check_return_ __inline long double __CRTDECL expl(_In_ long double _X) 846 { 847 return exp((double)_X); 848 } 849 850 _Check_return_ _ACRTIMP long double __cdecl exp2l(_In_ long double _X); 851 _Check_return_ _ACRTIMP long double __cdecl expm1l(_In_ long double _X); 852 853 _Check_return_ __inline long double __CRTDECL fabsl(_In_ long double _X) 854 { 855 return fabs((double)_X); 856 } 857 858 _Check_return_ _ACRTIMP long double __cdecl fdiml(_In_ long double _X, _In_ long double _Y); 859 860 _Check_return_ __inline long double __CRTDECL floorl(_In_ long double _X) 861 { 862 return floor((double)_X); 863 } 864 865 _Check_return_ _ACRTIMP long double __cdecl fmal(_In_ long double _X, _In_ long double _Y, _In_ long double _Z); 866 _Check_return_ _ACRTIMP long double __cdecl fmaxl(_In_ long double _X, _In_ long double _Y); 867 _Check_return_ _ACRTIMP long double __cdecl fminl(_In_ long double _X, _In_ long double _Y); 868 869 _Check_return_ __inline long double __CRTDECL fmodl(_In_ long double _X, _In_ long double _Y) 870 { 871 return fmod((double)_X, (double)_Y); 872 } 873 874 _Check_return_ __inline long double __CRTDECL frexpl(_In_ long double _X, _Out_ int *_Y) 875 { 876 return frexp((double)_X, _Y); 877 } 878 879 _Check_return_ _ACRTIMP int __cdecl ilogbl(_In_ long double _X); 880 881 _Check_return_ __inline long double __CRTDECL _hypotl(_In_ long double _X, _In_ long double _Y) 882 { 883 return _hypot((double)_X, (double)_Y); 884 } 885 886 _Check_return_ __inline long double __CRTDECL hypotl(_In_ long double _X, _In_ long double _Y) 887 { 888 return _hypot((double)_X, (double)_Y); 889 } 890 891 _Check_return_ __inline long double __CRTDECL ldexpl(_In_ long double _X, _In_ int _Y) 892 { 893 return ldexp((double)_X, _Y); 894 } 895 896 _Check_return_ _ACRTIMP long double __cdecl lgammal(_In_ long double _X); 897 _Check_return_ _ACRTIMP long long __cdecl llrintl(_In_ long double _X); 898 _Check_return_ _ACRTIMP long long __cdecl llroundl(_In_ long double _X); 899 900 _Check_return_ __inline long double __CRTDECL logl(_In_ long double _X) 901 { 902 return log((double)_X); 903 } 904 905 _Check_return_ __inline long double __CRTDECL log10l(_In_ long double _X) 906 { 907 return log10((double)_X); 908 } 909 910 _Check_return_ _ACRTIMP long double __cdecl log1pl(_In_ long double _X); 911 _Check_return_ _ACRTIMP long double __cdecl log2l(_In_ long double _X); 912 _Check_return_ _ACRTIMP long double __cdecl logbl(_In_ long double _X); 913 _Check_return_ _ACRTIMP long __cdecl lrintl(_In_ long double _X); 914 _Check_return_ _ACRTIMP long __cdecl lroundl(_In_ long double _X); 915 916 _Check_return_ __inline long double __CRTDECL modfl(_In_ long double _X, _Out_ long double* _Y) 917 { 918 double _F, _I; 919 _F = modf((double)_X, &_I); 920 *_Y = _I; 921 return _F; 922 } 923 924 _Check_return_ _ACRTIMP long double __cdecl nanl(_In_ char const* _X); 925 _Check_return_ _ACRTIMP long double __cdecl nearbyintl(_In_ long double _X); 926 _Check_return_ _ACRTIMP long double __cdecl nextafterl(_In_ long double _X, _In_ long double _Y); 927 _Check_return_ _ACRTIMP long double __cdecl nexttowardl(_In_ long double _X, _In_ long double _Y); 928 929 _Check_return_ __inline long double __CRTDECL powl(_In_ long double _X, _In_ long double _Y) 930 { 931 return pow((double)_X, (double)_Y); 932 } 933 934 _Check_return_ _ACRTIMP long double __cdecl remainderl(_In_ long double _X, _In_ long double _Y); 935 _Check_return_ _ACRTIMP long double __cdecl remquol(_In_ long double _X, _In_ long double _Y, _Out_ int* _Z); 936 _Check_return_ _ACRTIMP long double __cdecl rintl(_In_ long double _X); 937 _Check_return_ _ACRTIMP long double __cdecl roundl(_In_ long double _X); 938 _Check_return_ _ACRTIMP long double __cdecl scalblnl(_In_ long double _X, _In_ long _Y); 939 _Check_return_ _ACRTIMP long double __cdecl scalbnl(_In_ long double _X, _In_ int _Y); 940 941 _Check_return_ __inline long double __CRTDECL sinhl(_In_ long double _X) 942 { 943 return sinh((double)_X); 944 } 945 946 _Check_return_ __inline long double __CRTDECL sinl(_In_ long double _X) 947 { 948 return sin((double)_X); 949 } 950 951 _Check_return_ __inline long double __CRTDECL sqrtl(_In_ long double _X) 952 { 953 return sqrt((double)_X); 954 } 955 956 _Check_return_ __inline long double __CRTDECL tanhl(_In_ long double _X) 957 { 958 return tanh((double)_X); 959 } 960 961 _Check_return_ __inline long double __CRTDECL tanl(_In_ long double _X) 962 { 963 return tan((double)_X); 964 } 965 966 _Check_return_ _ACRTIMP long double __cdecl tgammal(_In_ long double _X); 967 _Check_return_ _ACRTIMP long double __cdecl truncl(_In_ long double _X); 968 969 #ifndef __cplusplus 970 #define _matherrl _matherr 971 #endif 972 973#endif // _CRT_FUNCTIONS_REQUIRED 974 975#if defined(_CRT_INTERNAL_NONSTDC_NAMES) && _CRT_INTERNAL_NONSTDC_NAMES 976 977 #define DOMAIN _DOMAIN 978 #define SING _SING 979 #define OVERFLOW _OVERFLOW 980 #define UNDERFLOW _UNDERFLOW 981 #define TLOSS _TLOSS 982 #define PLOSS _PLOSS 983 984 #define matherr _matherr 985 986 #ifndef __assembler 987 #ifndef _M_CEE_PURE 988 extern double HUGE; 989 #else 990 double const HUGE = _HUGE; 991 #endif 992 993 _CRT_NONSTDC_DEPRECATE(_j0) _Check_return_ _ACRTIMP double __cdecl j0(_In_ double _X); 994 _CRT_NONSTDC_DEPRECATE(_j1) _Check_return_ _ACRTIMP double __cdecl j1(_In_ double _X); 995 _CRT_NONSTDC_DEPRECATE(_jn) _Check_return_ _ACRTIMP double __cdecl jn(_In_ int _X, _In_ double _Y); 996 _CRT_NONSTDC_DEPRECATE(_y0) _Check_return_ _ACRTIMP double __cdecl y0(_In_ double _X); 997 _CRT_NONSTDC_DEPRECATE(_y1) _Check_return_ _ACRTIMP double __cdecl y1(_In_ double _X); 998 _CRT_NONSTDC_DEPRECATE(_yn) _Check_return_ _ACRTIMP double __cdecl yn(_In_ int _X, _In_ double _Y); 999 #endif // !__assembler 1000 1001#endif // _CRT_INTERNAL_NONSTDC_NAMES 1002 1003_CRT_END_C_HEADER 1004_UCRT_RESTORE_CLANG_WARNINGS 1005#pragma warning(pop) // _UCRT_DISABLED_WARNINGS 1006#endif /* _INC_MATH */