From 285ad721f46a277b7cde1f528ca5af147300ff03 Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Fri, 12 Mar 2004 19:47:20 +0000 Subject: [PATCH] The beginnings of math.h and float.h. --- include/Makefile.in | 1 + include/msvcrt/float.h | 93 ++++++++++++++++++++++++++++++++++++++++++ include/msvcrt/math.h | 81 ++++++++++++++++++++++++++++++++++++ 3 files changed, 175 insertions(+) create mode 100644 include/msvcrt/float.h diff --git a/include/Makefile.in b/include/Makefile.in index 7476e309755..fb4e0d06260 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -233,6 +233,7 @@ MSVCRT_INCLUDES = \ msvcrt/eh.h \ msvcrt/errno.h \ msvcrt/fcntl.h \ + msvcrt/float.h \ msvcrt/io.h \ msvcrt/limits.h \ msvcrt/locale.h \ diff --git a/include/msvcrt/float.h b/include/msvcrt/float.h new file mode 100644 index 00000000000..65b133fab1d --- /dev/null +++ b/include/msvcrt/float.h @@ -0,0 +1,93 @@ +/* + * Floating point arithmetic. + * + * Derived from the mingw header written by Colin Peters. + * Modified for Wine use by Hans Leidekker. + * This file is in the public domain. + */ + +#ifndef __WINE_FLOAT_H +#define __WINE_FLOAT_H +#ifndef __WINE_USE_MSVCRT +#define __WINE_USE_MSVCRT +#endif + +#ifndef MSVCRT +# ifdef USE_MSVCRT_PREFIX +# define MSVCRT(x) MSVCRT_##x +# else +# define MSVCRT(x) x +# endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* _controlfp masks and bitflags - x86 only so far */ +#ifdef __i386__ + +/* Control word masks for unMask */ +#define _MCW_EM 0x0008001F /* Error masks */ +#define _MCW_IC 0x00040000 /* Infinity */ +#define _MCW_RC 0x00000300 /* Rounding */ +#define _MCW_PC 0x00030000 /* Precision */ + +/* Control word values for unNew (use with related unMask above) */ +#define _EM_INVALID 0x00000010 +#define _EM_DENORMAL 0x00080000 +#define _EM_ZERODIVIDE 0x00000008 +#define _EM_OVERFLOW 0x00000004 +#define _EM_UNDERFLOW 0x00000002 +#define _EM_INEXACT 0x00000001 +#define _IC_AFFINE 0x00040000 +#define _IC_PROJECTIVE 0x00000000 +#define _RC_CHOP 0x00000300 +#define _RC_UP 0x00000200 +#define _RC_DOWN 0x00000100 +#define _RC_NEAR 0x00000000 +#define _PC_24 0x00020000 +#define _PC_53 0x00010000 +#define _PC_64 0x00000000 +#endif + +/* _statusfp bit flags */ +#define _SW_INEXACT 0x00000001 /* inexact (precision) */ +#define _SW_UNDERFLOW 0x00000002 /* underflow */ +#define _SW_OVERFLOW 0x00000004 /* overflow */ +#define _SW_ZERODIVIDE 0x00000008 /* zero divide */ +#define _SW_INVALID 0x00000010 /* invalid */ + +#define _SW_UNEMULATED 0x00000040 /* unemulated instruction */ +#define _SW_SQRTNEG 0x00000080 /* square root of a neg number */ +#define _SW_STACKOVERFLOW 0x00000200 /* FP stack overflow */ +#define _SW_STACKUNDERFLOW 0x00000400 /* FP stack underflow */ + +#define _SW_DENORMAL 0x00080000 /* denormal status bit */ + +/* fpclass constants */ +#define _FPCLASS_SNAN 0x0001 /* Signaling "Not a Number" */ +#define _FPCLASS_QNAN 0x0002 /* Quiet "Not a Number" */ +#define _FPCLASS_NINF 0x0004 /* Negative Infinity */ +#define _FPCLASS_NN 0x0008 /* Negative Normal */ +#define _FPCLASS_ND 0x0010 /* Negative Denormal */ +#define _FPCLASS_NZ 0x0020 /* Negative Zero */ +#define _FPCLASS_PZ 0x0040 /* Positive Zero */ +#define _FPCLASS_PD 0x0080 /* Positive Denormal */ +#define _FPCLASS_PN 0x0100 /* Positive Normal */ +#define _FPCLASS_PINF 0x0200 /* Positive Infinity */ + +double _copysign (double, double); +double _chgsign (double); +double _scalb(double, long); +double _logb(double); +double _nextafter(double, double); +int _finite(double); +int _isnan(double); +int _fpclass(double); + +#ifdef __cplusplus +} +#endif + +#endif /* __WINE_FLOAT_H */ diff --git a/include/msvcrt/math.h b/include/msvcrt/math.h index 0cba867a3ee..9e1233d7171 100644 --- a/include/msvcrt/math.h +++ b/include/msvcrt/math.h @@ -1,10 +1,91 @@ +/* + * Math functions. + * + * Derived from the mingw header written by Colin Peters. + * Modified for Wine use by Hans Leidekker. + * This file is in the public domain. + */ + #ifndef __WINE_MATH_H #define __WINE_MATH_H +#ifndef __WINE_USE_MSVCRT +#define __WINE_USE_MSVCRT +#endif + +#ifndef MSVCRT +# ifdef USE_MSVCRT_PREFIX +# define MSVCRT(x) MSVCRT_##x +# else +# define MSVCRT(x) x +# endif +#endif #ifdef __cplusplus extern "C" { #endif +#define _DOMAIN 1 /* domain error in argument */ +#define _SING 2 /* singularity */ +#define _OVERFLOW 3 /* range overflow */ +#define _UNDERFLOW 4 /* range underflow */ +#define _TLOSS 5 /* total loss of precision */ +#define _PLOSS 6 /* partial loss of precision */ + +#ifndef MSVCRT_EXCEPTION_DEFINED +#define MSVCRT_EXCEPTION_DEFINED +struct MSVCRT(_exception) +{ + int type; + char *name; + double arg1; + double arg2; + double retval; +}; +#endif /* MSVCRT_EXCEPTION_DEFINED */ + +#ifndef MSVCRT_COMPLEX_DEFINED +#define MSVCRT_COMPLEX_DEFINED +struct MSVCRT(_complex) +{ + double x; /* Real part */ + double y; /* Imaginary part */ +}; +#endif /* MSVCRT_COMPLEX_DEFINED */ + +double sin(double); +double cos(double); +double tan(double); +double sinh(double); +double cosh(double); +double tanh(double); +double asin(double); +double acos(double); +double atan(double); +double atan2(double, double); +double exp(double); +double log(double); +double log10(double); +double pow(double, double); +double sqrt(double); +double ceil(double); +double floor(double); +double fabs(double); +double ldexp(double, int); +double frexp(double, int*); +double modf(double, double*); +double fmod(double, double); + +double hypot(double, double); +double j0(double); +double j1(double); +double jn(int, double); +double y0(double); +double y1(double); +double yn(int, double); + +int MSVCRT(_matherr)(struct MSVCRT(_exception)*); +double MSVCRT(_cabs)(struct MSVCRT(_complex)); + #ifdef __cplusplus } #endif