Skip to main content

valueIsNegativeZero

Short summary

This assertion method checks if the current value is -0.0 for details check IEEE 754

Parameters

NameTypeCommentKind
currentValueLREALcurrent value to checkinput
messageAssertMessagemessage if the assertion is falseinput

Code

Declaration

{attribute 'analysis' := '-56'}
METHOD valueIsNegativeZero
VAR_INPUT
(* current value to check *)
currentValue :LREAL;
(* message if the assertion is false *)
message :AssertMessage;
END_VAR
VAR
(* just to cast ``currentValue`` *)
currentValueAsDWord :POINTER TO LWORD;
END_VAR

Implementation

currentValueAsDWord := ADR(currentValue);
IF (currentValueAsDWord^ <> THIS^.MASK_FOR_SIGN_BIT) THEN
THIS^.assertionWasWrong(message, THIS^.getDebugInfo('valueIsNegativeZero'));
END_IF