isEqualDetermine if two Real scalars are numerically identical |
This information is part of the Modelica Standard Library maintained by the Modelica Association.
Math.isEqual(s1, s2); Math.isEqual(s1, s2, eps=0);
The function call "Math.isEqual(s1, s2)
" returns true,
if the two Real scalars s1 and s2 are identical. Otherwise the function
returns false. The equality check is performed by
"abs(s1-s2) ≤ eps", where "eps"
can be provided as third argument of the function. Default is "eps = 0".
Real s1 = 2.0; Real s2 = 2.0; Real s3 = 2.000001; Boolean result; algorithm result := Math.isEqual(s1,s2); // = true result := Math.isEqual(s1,s3); // = false result := Math.isEqual(s1,s3,0.1); // = true
s1 |
Type: Real Description: First scalar |
---|---|
s2 |
Type: Real Description: Second scalar |
eps |
Default Value: 0 Type: Real Description: The two scalars are identical if abs(s1-s2) <= eps |
result |
Type: Boolean Description: = true, if scalars are identical |
---|