From 23a1f82cf5ee43b16606ceb16295435c1ff7f365 Mon Sep 17 00:00:00 2001 From: kristof <Kristof.Szabados@ericsson.com> Date: Sat, 25 Feb 2017 09:02:45 +0100 Subject: [PATCH] in newer version of the standard nans equal. Signed-off-by: kristof <Kristof.Szabados@ericsson.com> --- common/ttcn3float.hh | 2 +- regression_test/floatOper/TfloatOper.ttcn | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/common/ttcn3float.hh b/common/ttcn3float.hh index 2e7310a8f..63ccb75ed 100644 --- a/common/ttcn3float.hh +++ b/common/ttcn3float.hh @@ -105,7 +105,7 @@ struct ttcn3float { bool operator>(double d) const { if (isnan(value)) { - return true; // TTCN-3 special: NaN is bigger than anything except NaN + return !isnan(d); // TTCN-3 special: NaN is bigger than anything except NaN } else if (isnan(d)) { return false; // TTCN-3 special: NaN is bigger than anything except NaN diff --git a/regression_test/floatOper/TfloatOper.ttcn b/regression_test/floatOper/TfloatOper.ttcn index 1472efb35..b94b4d281 100644 --- a/regression_test/floatOper/TfloatOper.ttcn +++ b/regression_test/floatOper/TfloatOper.ttcn @@ -429,7 +429,8 @@ testcase floatComparison() runs on floatOper_comptype { var float NaN := not_a_number; if (NaN != not_a_number) { setverdict(fail, __LINE__, ": not_a_number==not_a_number:NotOK") } - + if (NaN < NaN) { setverdict(fail, __LINE__, ": not_a_number<not_a_number:NotOK") } + if (NaN > NaN) { setverdict(fail, __LINE__, ": not_a_number<not_a_number:NotOK") } } testcase constFloatComparison() runs on floatOper_comptype { @@ -476,7 +477,8 @@ testcase constFloatComparison() runs on floatOper_comptype { const float NaN := not_a_number; if (NaN != not_a_number) { setverdict(fail, __LINE__, ": not_a_number==not_a_number:NotOK") } - + if (NaN < NaN) { setverdict(fail, __LINE__, ": not_a_number<not_a_number:NotOK") } + if (NaN > NaN) { setverdict(fail, __LINE__, ": not_a_number<not_a_number:NotOK") } } control { -- GitLab