1
0
mirror of https://github.com/ThrowTheSwitch/Unity.git synced 2026-01-27 10:14:28 +01:00

We're going to use the C99 isinf() and isnan() macros wherever possible now. If your compiler doesn't support this, define UNITY_EXCLUDE_MATH_H and it will go back to the old method

This commit is contained in:
Mark VanderVoord
2015-11-13 09:16:42 -05:00
parent e4a99b5f96
commit c6dc96f387
6 changed files with 167 additions and 17 deletions

View File

@@ -36,6 +36,11 @@
//apparently this is not a constant expression: (sizeof(unsigned int *) * 256 - 1) so we have to just let this fall through
#endif
#endif
#ifndef UNITY_EXCLUDE_MATH_H
#include <math.h>
#endif
//-------------------------------------------------------
// Guess Widths If Not Specified
//-------------------------------------------------------
@@ -214,6 +219,23 @@ typedef _US64 _U_SINT;
#endif
typedef UNITY_FLOAT_TYPE _UF;
#ifndef isinf
#define isinf(n) (((1.0f / f_zero) == n) ? 1 : 0) || (((-1.0f / f_zero) == n) ? 1 : 0)
#define UNITY_FLOAT_NEEDS_ZERO
#endif
#ifndef isnan
#define isnan(n) ((n != n) ? 1 : 0)
#endif
#ifndef isneg
#define isneg(n) ((n < 0.0f) ? 1 : 0)
#endif
#ifndef ispos
#define ispos(n) ((n > 0.0f) ? 1 : 0)
#endif
#endif
//-------------------------------------------------------