Inline the isneg/ispos macros, remove promotion warnings on constants

Originated from commit c6dc96f3 but are rarely used and not in math.h
Removes float to double promotion warning and simplifies the code
'gcc -std=gnu99 -Wdouble-promotion' spits out these warnings
This commit is contained in:
jsalling
2016-12-29 20:47:03 -06:00
parent 0603c1cf1e
commit bd4ac58486
3 changed files with 16 additions and 30 deletions

View File

@ -187,6 +187,7 @@
#endif
typedef UNITY_FLOAT_TYPE UNITY_FLOAT;
/* isinf & isnan macros should be provided by math.h */
#ifndef isinf
/* The value of Inf - Inf is NaN */
#define isinf(n) (isnan((n) - (n)) && !isnan(n))
@ -198,14 +199,6 @@ typedef UNITY_FLOAT_TYPE UNITY_FLOAT;
#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
/*-------------------------------------------------------
@ -243,7 +236,7 @@ typedef UNITY_FLOAT_TYPE UNITY_FLOAT;
/* Double Floating Point Support */
#ifndef UNITY_DOUBLE_PRECISION
#define UNITY_DOUBLE_PRECISION (1e-12f)
#define UNITY_DOUBLE_PRECISION (1e-12)
#endif
#ifndef UNITY_DOUBLE_TYPE