Skip to main content

valueIsMin

Short summary

This assertion method checks if the current value is greater than or equal to the minimum value

Attention: Any comparsion to NaN is FALSE that means if currentValue OR minimumValue 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 | minimumValue | assertion | +======================+======================+===============+ | NaN | Any value | FASLE | +----------------------+----------------------+---------------+ | Any value | NaN | FALSE | +----------------------+----------------------+---------------+ | infinity | NOT NaN | TRUE | +----------------------+----------------------+---------------+ | NOT NaN | -infinity | TRUE | +----------------------+----------------------+---------------+ | -infinity | NOT -infinity | FALSE | +----------------------+----------------------+---------------+ | NOT infinity | infinity | FALSE | +----------------------+----------------------+---------------+

Parameters

NameTypeCommentKind
currentValueREALcurrent value to checkinput
minimumValueREALlower limit for the current valueinput
messageAssertMessagemessage if the assertion is falseinput

Code

Declaration

METHOD valueIsMin
VAR_INPUT
(* current value to check *)
currentValue :REAL;
(* lower limit for the current value *)
minimumValue :REAL;
(* message if the assertion is false *)
message :AssertMessage;
END_VAR

Implementation

IF (
THIS^.isValueNaN(currentValue)
OR_ELSE THIS^.isValueNaN(minimumValue)
OR_ELSE (
THIS^.isValueNegativeInfinite(currentValue)
AND_THEN (NOT THIS^.isValueNegativeInfinite(minimumValue))
) OR_ELSE (
THIS^.isValuePositiveInfinite(minimumValue)
AND_THEN (NOT THIS^.isValuePositiveInfinite(currentValue))
)
) THEN
THIS^.assertionWasWrong(message, THIS^.getDebugInfo('valueIsMin'));
ELSIF (
THIS^.isValuePositiveInfinite(currentValue)
OR_ELSE THIS^.isValueNegativeInfinite(minimumValue)
) THEN
RETURN;
ELSIF (currentValue < minimumValue) THEN
THIS^.assertionWasWrong(message, THIS^.getDebugInfo('valueIsMin'));
END_IF