Test case R0295
Full test suiteDevice test case
Floating point types
This test case it part of the test suite proposed for new devices.
Test case ID: R0295
Language: ST
tests2/t0295.st
(* floating point *)
FUNCTION F_R0295 : REAL // just a floating point division
VAR_INPUT i,j : INT ; END_VAR
F_R0295 := INT_TO_REAL(i)/INT_TO_REAL(j);
END_FUNCTION
PROGRAM R0295
VAR
f1,f2,f3 : REAL;
d1,d2 : LREAL;
END_VAR
d1 := LREAL#1.0E-6;
d1 := LREAL#0.5E6 * d1;
f1 := F_R0295(3,10000);
d2 := 1000.0;
f2 := F_R0295(6,100)+ LREAL_TO_REAL(d2);
d2 := f2; // no conversion necessary from REAL to LREAL
d2 := d2 * d2;
f3 := F_R0295(6,0); // floating point division by zero is well behaved
_GEB_ASSERT_EQDOUBLE_(d1 , 0.5);
_GEB_ASSERT_EQDOUBLE_(d2 , 1.00012e+06);
_GEB_ASSERT_EQFLOAT_(f1 , 3.0e-04);
_GEB_ASSERT_EQFLOAT_(f2 , 1000.06);
_GEB_ASSERT_EQFLOAT_(f3 , 1.0/0.0);
END_PROGRAM


