]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/math.h
3 * Purpose: Declarations/definitions of common math functions
4 * Author: John Labenski and others
8 * Copyright: (c) John Labenski
9 * Licence: wxWindows licence
12 /* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
22 #define M_PI 3.1415926535897932384626433832795
25 /* Scaling factors for various unit conversions */
26 #ifndef METRIC_CONVERSION_CONSTANT
27 #define METRIC_CONVERSION_CONSTANT 0.0393700787
31 #define mm2inches (METRIC_CONVERSION_CONSTANT)
35 #define inches2mm (1/(mm2inches))
39 #define mm2twips (METRIC_CONVERSION_CONSTANT*1440)
43 #define twips2mm (1/(mm2twips))
47 #define mm2pt (METRIC_CONVERSION_CONSTANT*72)
51 #define pt2mm (1/(mm2pt))
55 /* unknown __VISAGECC__, __SYMANTECCC__ */
57 #if defined(__VISUALC__) || defined(__BORLANDC__) || defined(__WATCOMC__)
59 #define wxFinite(x) _finite(x)
60 #elif defined(__GNUG__)||defined(__GNUWIN32__)||defined(__DJGPP__)|| \
61 defined(__SGI_CC__)||defined(__SUNCC__)||defined(__XLC__)|| \
62 defined(__HPUX__)||defined(__MWERKS__)
63 #define wxFinite(x) finite(x)
65 #define wxFinite(x) ((x) == (x))
69 #if defined(__VISUALC__)||defined(__BORLAND__)
70 #define wxIsNaN(x) _isnan(x)
71 #elif defined(__GNUG__)||defined(__GNUWIN32__)||defined(__DJGPP__)|| \
72 defined(__SGI_CC__)||defined(__SUNCC__)||defined(__XLC__)|| \
73 defined(__HPUX__)||defined(__MWERKS__)
74 #define wxIsNaN(x) isnan(x)
76 #define wxIsNaN(x) ((x) != (x))
81 inline bool wxIsSameDouble(double x
, double y
)
83 // VZ: this warning, given for operators==() and !=() is not wrong, as ==
84 // shouldn't be used with doubles, but we get too many of them and
85 // removing these operators is probably not a good idea
87 // Maybe we should alway compare doubles up to some "epsilon" precision
90 // floating-point equality and inequality comparisons are unreliable
91 #pragma warning(disable: 1572)
97 #else /* !__INTELC__ */
98 inline bool wxIsSameDouble(double x
, double y
) { return x
== y
; }
99 #endif /* __INTELC__/!__INTELC__ */
101 inline bool wxIsNullDouble(double x
) { return wxIsSameDouble(x
, 0.); }
102 #endif /* __cplusplus */
109 /* functions from common/extended.c */
110 extern wxFloat64
ConvertFromIeeeExtended(const wxInt8
*bytes
);
111 extern void ConvertToIeeeExtended(wxFloat64 num
, wxInt8
*bytes
);
115 #endif /* wxUSE_APPLE_IEEE */
118 #endif /* _WX_MATH_H_ */