Skip to main content

valueIsSubnormal

Short summary

This assertion method checks if the current value is a subnormal number for details check IEEE 754

Parameters

NameTypeCommentKind
currentValueREALcurrent value to checkinput
messageAssertMessagemessage if the assertion is falseinput

Code

Declaration

METHOD valueIsSubnormal
VAR_INPUT
(* current value to check *)
currentValue :REAL;
(* message if the assertion is false *)
message :AssertMessage;
END_VAR
VAR
(* just to cast ``currentValue`` *)
currentValueAsDWord :POINTER TO DWORD;
END_VAR

Implementation

IF (THIS^.isValueNaN(currentValue)) THEN
THIS^.assertionWasWrong(message, THIS^.getDebugInfo('valueIsSubnormal'));
ELSE
currentValueAsDWord := ADR(currentValue);
IF ((currentValueAsDWord^ AND THIS^.MASK_FOR_EXPONENT) <> THIS^.ZERO) THEN
THIS^.assertionWasWrong(message, THIS^.getDebugInfo('valueIsSubnormal'));
END_IF
END_IF