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
Vectors.isEqual, Matrices.isEqual, Strings.isEqual
function isEqual extends Modelica.Icons.Function; input Real s1 "First scalar"; input Real s2 "Second scalar"; input Real eps(min = 0) = 0 "The two scalars are identical if abs(s1-s2) <= eps"; output Boolean result "= true, if scalars are identical"; end isEqual;