Skip to main content

valueIsGreaterThan

Short summary

This assertion method checks if the current value is greater than the less value

Attention: Any comparsion to NaN is FALSE that means if currentValue OR lessValue is NaN then is the assertion false. For details check IEEE 754_ and the truth table below.

Attention: Every number is smaller than infinity except infinity, it's equal. Every number is greater than -infinity except -infinity, it's equal. For details check IEEE 754 and the truth table below.

truth table for special values

+----------------------+-------------------+---------------+ | currentValue | lessValue | assertion | +======================+===================+===============+ | NaN | Any value | FASLE | +----------------------+-------------------+---------------+ | Any value | NaN | FALSE | +----------------------+-------------------+---------------+ | infinity | NOT NaN | TRUE | | | NOT infinity | | +----------------------+-------------------+---------------+ | -infinity | Any value | FALSE | +----------------------+-------------------+---------------+ | Any value | infinity | FALSE | +----------------------+-------------------+---------------+ | NOT NaN | -inifinity | TRUE | | NOT -infinity | | | +----------------------+-------------------+---------------+

Parameters

NameTypeCommentKind
currentValueLREALcurrent value to checkinput
lessValueLREALless than lower limitinput
messageAssertMessagemessage if the assertion is falseinput

Code

Declaration

METHOD valueIsGreaterThan
VAR_INPUT
(* current value to check *)
currentValue :LREAL;
(* less than lower limit *)
lessValue :LREAL;
(* message if the assertion is false *)
message :AssertMessage;
END_VAR

Implementation

IF (
THIS^.isValueNaN(currentValue)
OR_ELSE THIS^.isValueNaN(lessValue)
OR_ELSE THIS^.isValueNegativeInfinite(currentValue)
OR_ELSE THIS^.isValuePositiveInfinite(lessValue)
)THEN
THIS^.assertionWasWrong(message, THIS^.getDebugInfo('valueIsGreaterThan'));
ELSIF (
THIS^.isValueNegativeInfinite(lessValue)
OR_ELSE THIS^.isValuePositiveInfinite(currentValue)
) THEN
RETURN;
ELSIF (currentValue <= lessValue) THEN
THIS^.assertionWasWrong(message, THIS^.getDebugInfo('valueIsGreaterThan'));
END_IF