Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

737 lines
26 KiB

  1. /***
  2. *math.h - definitions and declarations for math library
  3. *
  4. * Copyright (c) 1985-2001, 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. *Revision History:
  14. * 10/20/87 JCR Removed "MSC40_ONLY" entries
  15. * 12-11-87 JCR Added "_loadds" functionality
  16. * 12-18-87 JCR Added _FAR_ to declarations
  17. * 02-10-88 JCR Cleaned up white space
  18. * 02-10-88 WAJ Changed HUGE and HUGE_VAL definitions for DLL libraries
  19. * 05-32-88 PHG Added _CDECL and _NEAR for declaration of HUGE
  20. * 08-22-88 GJF Modified to also work with the 386 (small model only)
  21. * 05-03-89 JCR Added _INTERNAL_IFSTRIP for relinc usage
  22. * 08-02-89 GJF Cleanup, now specific to OS/2 2.0 (i.e., 386 flat model)
  23. * 10-30-89 GJF Fixed copyright
  24. * 11-02-89 JCR Changed "DLL" to "_DLL"
  25. * 11-20-89 JCR Routines are now _cdecl in both single and multi-thread
  26. * 12-14-89 WAJ Removed pascal from mthread version.
  27. * 03-01-90 GJF Added #ifndef _INC_MATH and #include <cruntime.h>
  28. * stuff. Also, removed some (now) useless preprocessor
  29. * directives.
  30. * 03-29-90 GJF Replaced _cdecl with _VARTYPE1, _CALLTYPE1 or
  31. * _CALLTYPE2, as appropriate.
  32. * 07-30-90 SBM Removed special _DLL definitions of HUGE and HUGE_VAL
  33. * 08-17-90 WAJ Floating point routines now use _stdcall.
  34. * 08-08-91 GJF Added long double stuff. ANSI naming.
  35. * 08-20-91 JCR C++ and ANSI naming
  36. * 09-28-91 JCR ANSI names: DOSX32=prototypes, WIN32=#defines for now
  37. * 10-03-91 GDP Added #pragma function(...)
  38. * No floating point intrinsics for WIN32/NT86
  39. * 10-06-91 SRW Removed long double stuff.
  40. * 01-24-92 GJF Fixed [_]HUGE for crtdll.dll.
  41. * 01-30-92 GJF Removed prototypes and macros for the ieee-to/from-
  42. * msbin functions (they don't exist).
  43. * 08-05-92 GJF Function calling type and variable type macros.
  44. * 12-18-92 GDP Removed #pragma function(...)
  45. * 01-21-93 GJF Removed support for C6-386's _cdecl.
  46. * 04-06-93 SKS Replace _CRTAPI1/2 with __cdecl, _CRTVAR1 with nothing
  47. * 04-07-93 SKS Add _CRTIMP keyword for CRT DLL model
  48. * Use link-time aliases for old names, not #define's
  49. * 10-07-93 GJF Merged NT and Cuda versions. Other fixes: Jonm's
  50. * #define for _hypotl was wrong, added #define for
  51. * _cabsl, added matherr to the 'oldnames' prototypes.
  52. * 01-13-94 RDL Added #ifndef _LANGUAGE_ASSEMBLY for asm includes.
  53. * 01-24-94 GJF Merged in 01-13 change above (from crt32 tree on
  54. * \\orville\razzle).
  55. * 08-05-94 GJF Added support for user-supplied _matherr routine
  56. * to msvcrt20.dll (Win32 and Win32s versions).
  57. * 11-03-94 GJF Ensure 8 byte alignment.
  58. * 12-10-94 BWT Add _CRTIMP to MIPS float math functions.
  59. * 12-30-94 JCF Merged with mac header.
  60. * 01-05-95 JCF Don't do the prototypes under _MAC_.
  61. * 01-09-95 JCF Don't do the prototypes only under _M_M68K.
  62. * 01-11-95 RDL Put #ifndef __assembler for asm includes back.
  63. * 02-11-95 CFW Add _CRTBLD to avoid users getting wrong headers.
  64. * 02-14-95 CFW Clean up Mac merge.
  65. * 03-03-95 CFW Remove bogus 'oldnames' 68k stuff.
  66. * 03-10-95 SAH add _CRTIMP to MIPS intrinsics
  67. * 05-16-95 CFW #define exception _exception removed - hoses class exception.
  68. * 12-14-95 JWM Add "#pragma once".
  69. * 03-05-96 JWM Added PlumHall modifications.
  70. * 05-06-96 JWM Inlines are now #ifndef _M_M68K.
  71. * 05-15-96 JWM Minor fix to remove a C4244 warning from the Pow_int template.
  72. * 08-28-96 JWM Added inline long __cdecl abs(long); also __cdecls to other inlines.
  73. * 09-09-96 JWM Inlines are now #ifndef _MSC_EXTENSIONS, i.e. -Za only.
  74. * 09-17-96 RKP Treat single precision routines on ALPHA like MIPS
  75. * 10-06-96 JWM _Pow_int template no longer #ifndef _MSC_EXTENSIONS.
  76. * 01-24-96 RKP Allow single precision routines to be used as intrinsics
  77. * 02-05-97 GJF Deleted obsolete support for _CRTAPI* and _NTSDK.
  78. * Also, detab-ed.
  79. * 06-23-97 GJF Fixed typo introduced by DEC checkin.
  80. * 09-30-97 JWM Restored not-so-obsolete _CRTAPI1 support.
  81. * 10-07-97 RDL Added IA64.
  82. * 11-19-97 JWM Cleaned up _Pow_int to prevent C4146.
  83. * 05-13-99 PML Remove _CRTAPI1
  84. * 05-17-99 PML Remove all Macintosh support.
  85. * 06-04-99 PML modff and hypotf are intrinsics on IA64.
  86. * 10-28-99 PML Add #defines for useful constants
  87. * 11-02-99 PML Add extern "C++" around C++ definitions.
  88. * 12-02-99 PML add defined(_M_MRX000) check (vs7#65291)
  89. * 02-07-01 GB Place math constant defines under #ifdef (vs7#193177).
  90. * 02-21-01 PML Add _set_SSE2_enable().
  91. *
  92. ****/
  93. #if _MSC_VER > 1000 /*IFSTRIP=IGN*/
  94. #pragma once
  95. #endif
  96. #ifndef _INC_MATH
  97. #define _INC_MATH
  98. #if !defined(_WIN32)
  99. #error ERROR: Only Win32 target supported!
  100. #endif
  101. #ifndef _CRTBLD
  102. /* This version of the header files is NOT for user programs.
  103. * It is intended for use when building the C runtimes ONLY.
  104. * The version intended for public use will not have this message.
  105. */
  106. #error ERROR: Use of C runtime library internal header file.
  107. #endif /* _CRTBLD */
  108. #ifdef _MSC_VER
  109. /*
  110. * Currently, all MS C compilers for Win32 platforms default to 8 byte
  111. * alignment.
  112. */
  113. #pragma pack(push,8)
  114. #endif /* _MSC_VER */
  115. #ifdef __cplusplus
  116. extern "C" {
  117. #endif
  118. #ifndef __assembler /* Protect from assembler */
  119. #ifndef _INTERNAL_IFSTRIP_
  120. #include <cruntime.h>
  121. #endif /* _INTERNAL_IFSTRIP_ */
  122. /* Define _CRTIMP */
  123. #ifndef _CRTIMP
  124. #ifdef CRTDLL
  125. #define _CRTIMP __declspec(dllexport)
  126. #else /* ndef CRTDLL */
  127. #ifdef _DLL
  128. #define _CRTIMP __declspec(dllimport)
  129. #else /* ndef _DLL */
  130. #define _CRTIMP
  131. #endif /* _DLL */
  132. #endif /* CRTDLL */
  133. #endif /* _CRTIMP */
  134. /* Define __cdecl for non-Microsoft compilers */
  135. #if ( !defined(_MSC_VER) && !defined(__cdecl) )
  136. #define __cdecl
  137. #endif
  138. /* Definition of _exception struct - this struct is passed to the matherr
  139. * routine when a floating point exception is detected
  140. */
  141. #ifndef _EXCEPTION_DEFINED
  142. struct _exception {
  143. int type; /* exception type - see below */
  144. char *name; /* name of function where error occured */
  145. double arg1; /* first argument to function */
  146. double arg2; /* second argument (if any) to function */
  147. double retval; /* value to be returned by function */
  148. } ;
  149. #define _EXCEPTION_DEFINED
  150. #endif
  151. /* Definition of a _complex struct to be used by those who use cabs and
  152. * want type checking on their argument
  153. */
  154. #ifndef _COMPLEX_DEFINED
  155. struct _complex {
  156. double x,y; /* real and imaginary parts */
  157. } ;
  158. #if !__STDC__ && !defined (__cplusplus) /*IFSTRIP=IGN*/
  159. /* Non-ANSI name for compatibility */
  160. #define complex _complex
  161. #endif
  162. #define _COMPLEX_DEFINED
  163. #endif
  164. #endif /* __assembler */
  165. /* Constant definitions for the exception type passed in the _exception struct
  166. */
  167. #define _DOMAIN 1 /* argument domain error */
  168. #define _SING 2 /* argument singularity */
  169. #define _OVERFLOW 3 /* overflow range error */
  170. #define _UNDERFLOW 4 /* underflow range error */
  171. #define _TLOSS 5 /* total loss of precision */
  172. #define _PLOSS 6 /* partial loss of precision */
  173. #define EDOM 33
  174. #define ERANGE 34
  175. /* Definitions of _HUGE and HUGE_VAL - respectively the XENIX and ANSI names
  176. * for a value returned in case of error by a number of the floating point
  177. * math routines
  178. */
  179. #ifndef __assembler /* Protect from assembler */
  180. _CRTIMP extern double _HUGE;
  181. #endif /* __assembler */
  182. #define HUGE_VAL _HUGE
  183. #ifdef _USE_MATH_DEFINES
  184. /* Define _USE_MATH_DEFINES before including math.h to expose these macro
  185. * definitions for common math constants. These are placed under an #ifdef
  186. * since these commonly-defined names are not part of the C/C++ standards.
  187. */
  188. /* Definitions of useful mathematical constants
  189. * M_E - e
  190. * M_LOG2E - log2(e)
  191. * M_LOG10E - log10(e)
  192. * M_LN2 - ln(2)
  193. * M_LN10 - ln(10)
  194. * M_PI - pi
  195. * M_PI_2 - pi/2
  196. * M_PI_4 - pi/4
  197. * M_1_PI - 1/pi
  198. * M_2_PI - 2/pi
  199. * M_2_SQRTPI - 2/sqrt(pi)
  200. * M_SQRT2 - sqrt(2)
  201. * M_SQRT1_2 - 1/sqrt(2)
  202. */
  203. #define M_E 2.71828182845904523536
  204. #define M_LOG2E 1.44269504088896340736
  205. #define M_LOG10E 0.434294481903251827651
  206. #define M_LN2 0.693147180559945309417
  207. #define M_LN10 2.30258509299404568402
  208. #define M_PI 3.14159265358979323846
  209. #define M_PI_2 1.57079632679489661923
  210. #define M_PI_4 0.785398163397448309616
  211. #define M_1_PI 0.318309886183790671538
  212. #define M_2_PI 0.636619772367581343076
  213. #define M_2_SQRTPI 1.12837916709551257390
  214. #define M_SQRT2 1.41421356237309504880
  215. #define M_SQRT1_2 0.707106781186547524401
  216. #endif /* _USE_MATH_DEFINES */
  217. /* Function prototypes */
  218. #if !defined(__assembler) /* Protect from assembler */
  219. #if defined(_M_MRX000)
  220. _CRTIMP int __cdecl abs(int);
  221. _CRTIMP double __cdecl acos(double);
  222. _CRTIMP double __cdecl asin(double);
  223. _CRTIMP double __cdecl atan(double);
  224. _CRTIMP double __cdecl atan2(double, double);
  225. _CRTIMP double __cdecl cos(double);
  226. _CRTIMP double __cdecl cosh(double);
  227. _CRTIMP double __cdecl exp(double);
  228. _CRTIMP double __cdecl fabs(double);
  229. _CRTIMP double __cdecl fmod(double, double);
  230. _CRTIMP long __cdecl labs(long);
  231. _CRTIMP double __cdecl log(double);
  232. _CRTIMP double __cdecl log10(double);
  233. _CRTIMP double __cdecl pow(double, double);
  234. _CRTIMP double __cdecl sin(double);
  235. _CRTIMP double __cdecl sinh(double);
  236. _CRTIMP double __cdecl tan(double);
  237. _CRTIMP double __cdecl tanh(double);
  238. _CRTIMP double __cdecl sqrt(double);
  239. #else
  240. int __cdecl abs(int);
  241. double __cdecl acos(double);
  242. double __cdecl asin(double);
  243. double __cdecl atan(double);
  244. double __cdecl atan2(double, double);
  245. double __cdecl cos(double);
  246. double __cdecl cosh(double);
  247. double __cdecl exp(double);
  248. double __cdecl fabs(double);
  249. double __cdecl fmod(double, double);
  250. long __cdecl labs(long);
  251. double __cdecl log(double);
  252. double __cdecl log10(double);
  253. double __cdecl pow(double, double);
  254. double __cdecl sin(double);
  255. double __cdecl sinh(double);
  256. double __cdecl tan(double);
  257. double __cdecl tanh(double);
  258. double __cdecl sqrt(double);
  259. #endif
  260. _CRTIMP double __cdecl atof(const char *);
  261. _CRTIMP double __cdecl _cabs(struct _complex);
  262. #if defined(_M_ALPHA)
  263. double __cdecl ceil(double);
  264. double __cdecl floor(double);
  265. #else
  266. _CRTIMP double __cdecl ceil(double);
  267. _CRTIMP double __cdecl floor(double);
  268. #endif
  269. _CRTIMP double __cdecl frexp(double, int *);
  270. _CRTIMP double __cdecl _hypot(double, double);
  271. _CRTIMP double __cdecl _j0(double);
  272. _CRTIMP double __cdecl _j1(double);
  273. _CRTIMP double __cdecl _jn(int, double);
  274. _CRTIMP double __cdecl ldexp(double, int);
  275. int __cdecl _matherr(struct _exception *);
  276. _CRTIMP double __cdecl modf(double, double *);
  277. _CRTIMP double __cdecl _y0(double);
  278. _CRTIMP double __cdecl _y1(double);
  279. _CRTIMP double __cdecl _yn(int, double);
  280. #if defined(_M_IX86)
  281. _CRTIMP int __cdecl _set_SSE2_enable(int);
  282. #endif
  283. #if defined(_M_MRX000)
  284. /* MIPS fast prototypes for float */
  285. /* ANSI C, 4.5 Mathematics */
  286. /* 4.5.2 Trigonometric functions */
  287. _CRTIMP float __cdecl acosf( float );
  288. _CRTIMP float __cdecl asinf( float );
  289. _CRTIMP float __cdecl atanf( float );
  290. _CRTIMP float __cdecl atan2f( float , float );
  291. _CRTIMP float __cdecl cosf( float );
  292. _CRTIMP float __cdecl sinf( float );
  293. _CRTIMP float __cdecl tanf( float );
  294. /* 4.5.3 Hyperbolic functions */
  295. _CRTIMP float __cdecl coshf( float );
  296. _CRTIMP float __cdecl sinhf( float );
  297. _CRTIMP float __cdecl tanhf( float );
  298. /* 4.5.4 Exponential and logarithmic functions */
  299. _CRTIMP float __cdecl expf( float );
  300. _CRTIMP float __cdecl logf( float );
  301. _CRTIMP float __cdecl log10f( float );
  302. _CRTIMP float __cdecl modff( float , float* );
  303. /* 4.5.5 Power functions */
  304. _CRTIMP float __cdecl powf( float , float );
  305. float __cdecl sqrtf( float );
  306. /* 4.5.6 Nearest integer, absolute value, and remainder functions */
  307. float __cdecl ceilf( float );
  308. float __cdecl fabsf( float );
  309. float __cdecl floorf( float );
  310. _CRTIMP float __cdecl fmodf( float , float );
  311. _CRTIMP float __cdecl hypotf(float, float);
  312. #endif /* _M_MRX000 */
  313. #if defined(_M_ALPHA)
  314. /* ALPHA fast prototypes for float */
  315. /* ANSI C, 4.5 Mathematics */
  316. /* 4.5.2 Trigonometric functions */
  317. float __cdecl acosf( float );
  318. float __cdecl asinf( float );
  319. float __cdecl atanf( float );
  320. float __cdecl atan2f( float , float );
  321. float __cdecl cosf( float );
  322. float __cdecl sinf( float );
  323. float __cdecl tanf( float );
  324. /* 4.5.3 Hyperbolic functions */
  325. float __cdecl coshf( float );
  326. float __cdecl sinhf( float );
  327. float __cdecl tanhf( float );
  328. /* 4.5.4 Exponential and logarithmic functions */
  329. float __cdecl expf( float );
  330. float __cdecl logf( float );
  331. float __cdecl log10f( float );
  332. _CRTIMP float __cdecl modff( float , float* );
  333. /* 4.5.5 Power functions */
  334. float __cdecl powf( float , float );
  335. float __cdecl sqrtf( float );
  336. /* 4.5.6 Nearest integer, absolute value, and remainder functions */
  337. float __cdecl ceilf( float );
  338. float __cdecl fabsf( float );
  339. float __cdecl floorf( float );
  340. float __cdecl fmodf( float , float );
  341. _CRTIMP float __cdecl _hypotf(float, float);
  342. #endif /* _M_ALPHA */
  343. #if defined(_M_IA64)
  344. /* ANSI C, 4.5 Mathematics */
  345. /* 4.5.2 Trigonometric functions */
  346. float __cdecl acosf( float );
  347. float __cdecl asinf( float );
  348. float __cdecl atanf( float );
  349. float __cdecl atan2f( float , float );
  350. float __cdecl cosf( float );
  351. float __cdecl sinf( float );
  352. float __cdecl tanf( float );
  353. /* 4.5.3 Hyperbolic functions */
  354. float __cdecl coshf( float );
  355. float __cdecl sinhf( float );
  356. float __cdecl tanhf( float );
  357. /* 4.5.4 Exponential and logarithmic functions */
  358. float __cdecl expf( float );
  359. float __cdecl logf( float );
  360. float __cdecl log10f( float );
  361. float __cdecl modff( float , float* );
  362. /* 4.5.5 Power functions */
  363. float __cdecl powf( float , float );
  364. float __cdecl sqrtf( float );
  365. /* 4.5.6 Nearest integer, absolute value, and remainder functions */
  366. float __cdecl ceilf( float );
  367. float __cdecl fabsf( float );
  368. float __cdecl floorf( float );
  369. float __cdecl fmodf( float , float );
  370. float __cdecl hypotf(float, float);
  371. #endif /* _M_IA64 */
  372. /* Macros defining long double functions to be their double counterparts
  373. * (long double is synonymous with double in this implementation).
  374. */
  375. #ifndef __cplusplus /*IFSTRIP=IGN*/
  376. #define acosl(x) ((long double)acos((double)(x)))
  377. #define asinl(x) ((long double)asin((double)(x)))
  378. #define atanl(x) ((long double)atan((double)(x)))
  379. #define atan2l(x,y) ((long double)atan2((double)(x), (double)(y)))
  380. #define _cabsl _cabs
  381. #define ceill(x) ((long double)ceil((double)(x)))
  382. #define cosl(x) ((long double)cos((double)(x)))
  383. #define coshl(x) ((long double)cosh((double)(x)))
  384. #define expl(x) ((long double)exp((double)(x)))
  385. #define fabsl(x) ((long double)fabs((double)(x)))
  386. #define floorl(x) ((long double)floor((double)(x)))
  387. #define fmodl(x,y) ((long double)fmod((double)(x), (double)(y)))
  388. #define frexpl(x,y) ((long double)frexp((double)(x), (y)))
  389. #define _hypotl(x,y) ((long double)_hypot((double)(x), (double)(y)))
  390. #define ldexpl(x,y) ((long double)ldexp((double)(x), (y)))
  391. #define logl(x) ((long double)log((double)(x)))
  392. #define log10l(x) ((long double)log10((double)(x)))
  393. #define _matherrl _matherr
  394. #define modfl(x,y) ((long double)modf((double)(x), (double *)(y)))
  395. #define powl(x,y) ((long double)pow((double)(x), (double)(y)))
  396. #define sinl(x) ((long double)sin((double)(x)))
  397. #define sinhl(x) ((long double)sinh((double)(x)))
  398. #define sqrtl(x) ((long double)sqrt((double)(x)))
  399. #define tanl(x) ((long double)tan((double)(x)))
  400. #define tanhl(x) ((long double)tanh((double)(x)))
  401. #else /* __cplusplus */
  402. inline long double acosl(long double _X)
  403. {return (acos((double)_X)); }
  404. inline long double asinl(long double _X)
  405. {return (asin((double)_X)); }
  406. inline long double atanl(long double _X)
  407. {return (atan((double)_X)); }
  408. inline long double atan2l(long double _X, long double _Y)
  409. {return (atan2((double)_X, (double)_Y)); }
  410. inline long double ceill(long double _X)
  411. {return (ceil((double)_X)); }
  412. inline long double cosl(long double _X)
  413. {return (cos((double)_X)); }
  414. inline long double coshl(long double _X)
  415. {return (cosh((double)_X)); }
  416. inline long double expl(long double _X)
  417. {return (exp((double)_X)); }
  418. inline long double fabsl(long double _X)
  419. {return (fabs((double)_X)); }
  420. inline long double floorl(long double _X)
  421. {return (floor((double)_X)); }
  422. inline long double fmodl(long double _X, long double _Y)
  423. {return (fmod((double)_X, (double)_Y)); }
  424. inline long double frexpl(long double _X, int *_Y)
  425. {return (frexp((double)_X, _Y)); }
  426. inline long double ldexpl(long double _X, int _Y)
  427. {return (ldexp((double)_X, _Y)); }
  428. inline long double logl(long double _X)
  429. {return (log((double)_X)); }
  430. inline long double log10l(long double _X)
  431. {return (log10((double)_X)); }
  432. inline long double modfl(long double _X, long double *_Y)
  433. {double _Di, _Df = modf((double)_X, &_Di);
  434. *_Y = (long double)_Di;
  435. return (_Df); }
  436. inline long double powl(long double _X, long double _Y)
  437. {return (pow((double)_X, (double)_Y)); }
  438. inline long double sinl(long double _X)
  439. {return (sin((double)_X)); }
  440. inline long double sinhl(long double _X)
  441. {return (sinh((double)_X)); }
  442. inline long double sqrtl(long double _X)
  443. {return (sqrt((double)_X)); }
  444. inline long double tanl(long double _X)
  445. {return (tan((double)_X)); }
  446. inline long double tanhl(long double _X)
  447. {return (tanh((double)_X)); }
  448. inline float frexpf(float _X, int *_Y)
  449. {return ((float)frexp((double)_X, _Y)); }
  450. inline float ldexpf(float _X, int _Y)
  451. {return ((float)ldexp((double)_X, _Y)); }
  452. #if !defined(_M_MRX000) && !defined(_M_ALPHA) && !defined(_M_IA64)
  453. inline float acosf(float _X)
  454. {return ((float)acos((double)_X)); }
  455. inline float asinf(float _X)
  456. {return ((float)asin((double)_X)); }
  457. inline float atanf(float _X)
  458. {return ((float)atan((double)_X)); }
  459. inline float atan2f(float _X, float _Y)
  460. {return ((float)atan2((double)_X, (double)_Y)); }
  461. inline float ceilf(float _X)
  462. {return ((float)ceil((double)_X)); }
  463. inline float cosf(float _X)
  464. {return ((float)cos((double)_X)); }
  465. inline float coshf(float _X)
  466. {return ((float)cosh((double)_X)); }
  467. inline float expf(float _X)
  468. {return ((float)exp((double)_X)); }
  469. inline float fabsf(float _X)
  470. {return ((float)fabs((double)_X)); }
  471. inline float floorf(float _X)
  472. {return ((float)floor((double)_X)); }
  473. inline float fmodf(float _X, float _Y)
  474. {return ((float)fmod((double)_X, (double)_Y)); }
  475. inline float logf(float _X)
  476. {return ((float)log((double)_X)); }
  477. inline float log10f(float _X)
  478. {return ((float)log10((double)_X)); }
  479. inline float modff(float _X, float *_Y)
  480. { double _Di, _Df = modf((double)_X, &_Di);
  481. *_Y = (float)_Di;
  482. return ((float)_Df); }
  483. inline float powf(float _X, float _Y)
  484. {return ((float)pow((double)_X, (double)_Y)); }
  485. inline float sinf(float _X)
  486. {return ((float)sin((double)_X)); }
  487. inline float sinhf(float _X)
  488. {return ((float)sinh((double)_X)); }
  489. inline float sqrtf(float _X)
  490. {return ((float)sqrt((double)_X)); }
  491. inline float tanf(float _X)
  492. {return ((float)tan((double)_X)); }
  493. inline float tanhf(float _X)
  494. {return ((float)tanh((double)_X)); }
  495. #endif /* !defined(_M_MRX000) && !defined(_M_ALPHA) && !defined(_M_IA64) */
  496. #endif /* __cplusplus */
  497. #endif /* __assembler */
  498. #if !__STDC__
  499. /* Non-ANSI names for compatibility */
  500. #define DOMAIN _DOMAIN
  501. #define SING _SING
  502. #define OVERFLOW _OVERFLOW
  503. #define UNDERFLOW _UNDERFLOW
  504. #define TLOSS _TLOSS
  505. #define PLOSS _PLOSS
  506. #define matherr _matherr
  507. #ifndef __assembler /* Protect from assembler */
  508. _CRTIMP extern double HUGE;
  509. _CRTIMP double __cdecl cabs(struct _complex);
  510. _CRTIMP double __cdecl hypot(double, double);
  511. _CRTIMP double __cdecl j0(double);
  512. _CRTIMP double __cdecl j1(double);
  513. _CRTIMP double __cdecl jn(int, double);
  514. int __cdecl matherr(struct _exception *);
  515. _CRTIMP double __cdecl y0(double);
  516. _CRTIMP double __cdecl y1(double);
  517. _CRTIMP double __cdecl yn(int, double);
  518. #endif /* __assembler */
  519. #endif /* __STDC__ */
  520. #ifdef __cplusplus /*IFSTRIP=IGN*/
  521. }
  522. extern "C++" {
  523. template<class _Ty> inline
  524. _Ty _Pow_int(_Ty _X, int _Y)
  525. {unsigned int _N;
  526. if (_Y >= 0)
  527. _N = _Y;
  528. else
  529. _N = -_Y;
  530. for (_Ty _Z = _Ty(1); ; _X *= _X)
  531. {if ((_N & 1) != 0)
  532. _Z *= _X;
  533. if ((_N >>= 1) == 0)
  534. return (_Y < 0 ? _Ty(1) / _Z : _Z); }}
  535. #ifndef _MSC_EXTENSIONS
  536. inline long __cdecl abs(long _X)
  537. {return (labs(_X)); }
  538. inline double __cdecl abs(double _X)
  539. {return (fabs(_X)); }
  540. inline double __cdecl pow(double _X, int _Y)
  541. {return (_Pow_int(_X, _Y)); }
  542. inline double __cdecl pow(int _X, int _Y)
  543. {return (_Pow_int(_X, _Y)); }
  544. inline float __cdecl abs(float _X)
  545. {return (fabsf(_X)); }
  546. inline float __cdecl acos(float _X)
  547. {return (acosf(_X)); }
  548. inline float __cdecl asin(float _X)
  549. {return (asinf(_X)); }
  550. inline float __cdecl atan(float _X)
  551. {return (atanf(_X)); }
  552. inline float __cdecl atan2(float _Y, float _X)
  553. {return (atan2f(_Y, _X)); }
  554. inline float __cdecl ceil(float _X)
  555. {return (ceilf(_X)); }
  556. inline float __cdecl cos(float _X)
  557. {return (cosf(_X)); }
  558. inline float __cdecl cosh(float _X)
  559. {return (coshf(_X)); }
  560. inline float __cdecl exp(float _X)
  561. {return (expf(_X)); }
  562. inline float __cdecl fabs(float _X)
  563. {return (fabsf(_X)); }
  564. inline float __cdecl floor(float _X)
  565. {return (floorf(_X)); }
  566. inline float __cdecl fmod(float _X, float _Y)
  567. {return (fmodf(_X, _Y)); }
  568. inline float __cdecl frexp(float _X, int * _Y)
  569. {return (frexpf(_X, _Y)); }
  570. inline float __cdecl ldexp(float _X, int _Y)
  571. {return (ldexpf(_X, _Y)); }
  572. inline float __cdecl log(float _X)
  573. {return (logf(_X)); }
  574. inline float __cdecl log10(float _X)
  575. {return (log10f(_X)); }
  576. inline float __cdecl modf(float _X, float * _Y)
  577. {return (modff(_X, _Y)); }
  578. inline float __cdecl pow(float _X, float _Y)
  579. {return (powf(_X, _Y)); }
  580. inline float __cdecl pow(float _X, int _Y)
  581. {return (_Pow_int(_X, _Y)); }
  582. inline float __cdecl sin(float _X)
  583. {return (sinf(_X)); }
  584. inline float __cdecl sinh(float _X)
  585. {return (sinhf(_X)); }
  586. inline float __cdecl sqrt(float _X)
  587. {return (sqrtf(_X)); }
  588. inline float __cdecl tan(float _X)
  589. {return (tanf(_X)); }
  590. inline float __cdecl tanh(float _X)
  591. {return (tanhf(_X)); }
  592. inline long double __cdecl abs(long double _X)
  593. {return (fabsl(_X)); }
  594. inline long double __cdecl acos(long double _X)
  595. {return (acosl(_X)); }
  596. inline long double __cdecl asin(long double _X)
  597. {return (asinl(_X)); }
  598. inline long double __cdecl atan(long double _X)
  599. {return (atanl(_X)); }
  600. inline long double __cdecl atan2(long double _Y, long double _X)
  601. {return (atan2l(_Y, _X)); }
  602. inline long double __cdecl ceil(long double _X)
  603. {return (ceill(_X)); }
  604. inline long double __cdecl cos(long double _X)
  605. {return (cosl(_X)); }
  606. inline long double __cdecl cosh(long double _X)
  607. {return (coshl(_X)); }
  608. inline long double __cdecl exp(long double _X)
  609. {return (expl(_X)); }
  610. inline long double __cdecl fabs(long double _X)
  611. {return (fabsl(_X)); }
  612. inline long double __cdecl floor(long double _X)
  613. {return (floorl(_X)); }
  614. inline long double __cdecl fmod(long double _X, long double _Y)
  615. {return (fmodl(_X, _Y)); }
  616. inline long double __cdecl frexp(long double _X, int * _Y)
  617. {return (frexpl(_X, _Y)); }
  618. inline long double __cdecl ldexp(long double _X, int _Y)
  619. {return (ldexpl(_X, _Y)); }
  620. inline long double __cdecl log(long double _X)
  621. {return (logl(_X)); }
  622. inline long double __cdecl log10(long double _X)
  623. {return (log10l(_X)); }
  624. inline long double __cdecl modf(long double _X, long double * _Y)
  625. {return (modfl(_X, _Y)); }
  626. inline long double __cdecl pow(long double _X, long double _Y)
  627. {return (powl(_X, _Y)); }
  628. inline long double __cdecl pow(long double _X, int _Y)
  629. {return (_Pow_int(_X, _Y)); }
  630. inline long double __cdecl sin(long double _X)
  631. {return (sinl(_X)); }
  632. inline long double __cdecl sinh(long double _X)
  633. {return (sinhl(_X)); }
  634. inline long double __cdecl sqrt(long double _X)
  635. {return (sqrtl(_X)); }
  636. inline long double __cdecl tan(long double _X)
  637. {return (tanl(_X)); }
  638. inline long double __cdecl tanh(long double _X)
  639. {return (tanhl(_X)); }
  640. #endif /* _MSC_EXTENSIONS */
  641. }
  642. #endif /* __cplusplus */
  643. #ifdef _MSC_VER
  644. #pragma pack(pop)
  645. #endif /* _MSC_VER */
  646. #endif /* _INC_MATH */