From ac455f2798cc2f2eff7e27740af487d60fbafad1 Mon Sep 17 00:00:00 2001 From: Mark VanderVoord Date: Tue, 15 Nov 2016 09:29:08 -0500 Subject: [PATCH] =?UTF-8?q?We=20can=E2=80=99t=20guarantee=20that=20the=20b?= =?UTF-8?q?uilt-in=20function=20insane=20will=20return=201.=20It=20might?= =?UTF-8?q?=20return=20any=20other=20non-negative=20value.=20Therefore=20w?= =?UTF-8?q?e=20need=20to=20force=20it=20to=20be=201=20so=20we=20can=20use?= =?UTF-8?q?=20the=20comparison=20operator=20later.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/unity.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/unity.c b/src/unity.c index 5740657..a79f6d4 100644 --- a/src/unity.c +++ b/src/unity.c @@ -733,13 +733,13 @@ void UnityAssertFloatSpecial(const _UF actual, case UNITY_FLOAT_IS_NAN: case UNITY_FLOAT_IS_NOT_NAN: - is_trait = isnan(actual); + is_trait = isnan(actual) ? 1 : 0; break; /* A determinate number is non infinite and not NaN. (therefore the opposite of the two above) */ case UNITY_FLOAT_IS_DET: case UNITY_FLOAT_IS_NOT_DET: - if (isinf(actual) | isnan(actual)) + if (isinf(actual) || isnan(actual)) is_trait = 0; else is_trait = 1; @@ -876,13 +876,13 @@ void UnityAssertDoubleSpecial(const _UD actual, case UNITY_FLOAT_IS_NAN: case UNITY_FLOAT_IS_NOT_NAN: - is_trait = isnan(actual); + is_trait = isnan(actual) ? 1 : 0; break; /* A determinate number is non infinite and not NaN. (therefore the opposite of the two above) */ case UNITY_FLOAT_IS_DET: case UNITY_FLOAT_IS_NOT_DET: - if (isinf(actual) | isnan(actual)) + if (isinf(actual) || isnan(actual)) is_trait = 0; else is_trait = 1; -- GitLab