diff --git a/common/ttcn3float.hh b/common/ttcn3float.hh index 2e7310a8f69f53267459df2b506e2d0b90a9798a..63ccb75edac2e26410cc34de5145bbbcd6597d85 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 1472efb3560e8e7f5836281ab8142f72565988ad..b94b4d281a9aaa5c5164c7b495bbec3c754771e7 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 {