From 40b3fdd80d995915066b04c95023c9593524a997 Mon Sep 17 00:00:00 2001 From: Evgueni Souleimanov Date: Tue, 17 Jun 2014 21:22:27 -0400 Subject: [PATCH] tests: use fabsf (float), not fabs (double) in epsilon comparisons of floats Fixes a mistake in commit f68eb7c --- tests.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests.c b/tests.c index b3eeace..269a042 100644 --- a/tests.c +++ b/tests.c @@ -853,18 +853,18 @@ END_TEST START_TEST(test_minmea_float) { ck_assert(isnan(minmea_tofloat(&(struct minmea_float) { 42, 0 }))); - ck_assert(fabs(minmea_tofloat(&(struct minmea_float) { 7, 1}) - 7.0) <= 0.0f); - ck_assert(fabs(minmea_tofloat(&(struct minmea_float) { -200, 100}) - (-2.0)) <= 0.0f); - ck_assert(fabs(minmea_tofloat(&(struct minmea_float) { 15, 10}) - 1.5) <= 0.0f); + ck_assert(fabsf(minmea_tofloat(&(struct minmea_float) { 7, 1}) - 7.0f) <= 0.0f); + ck_assert(fabsf(minmea_tofloat(&(struct minmea_float) { -200, 100}) - (-2.0f)) <= 0.0f); + ck_assert(fabsf(minmea_tofloat(&(struct minmea_float) { 15, 10}) - 1.5f) <= 0.0f); } END_TEST START_TEST(test_minmea_coord) { ck_assert(isnan(minmea_tocoord(&(struct minmea_float) { 42, 0 }))); - ck_assert(fabs(minmea_tocoord(&(struct minmea_float) { 4200, 1 }) - 42.0) <= 0.0f); - ck_assert(fabs(minmea_tocoord(&(struct minmea_float) { 420000, 100 }) - 42.0) <= 0.0f); - ck_assert(fabs(minmea_tocoord(&(struct minmea_float) { 423000, 100 }) - 42.5) <= 0.0f); + ck_assert(fabsf(minmea_tocoord(&(struct minmea_float) { 4200, 1 }) - 42.0f) <= 0.0f); + ck_assert(fabsf(minmea_tocoord(&(struct minmea_float) { 420000, 100 }) - 42.0f) <= 0.0f); + ck_assert(fabsf(minmea_tocoord(&(struct minmea_float) { 423000, 100 }) - 42.5f) <= 0.0f); } END_TEST