.Modelica.Math.isEqual

Information

Syntax

Math.isEqual(s1, s2);
Math.isEqual(s1, s2, eps=0);

Description

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".

Example

  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

See also

Vectors.isEqual, Matrices.isEqual, Strings.isEqual

Interface

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;

Generated at 2020-06-05T07:38:22Z by OpenModelica 1.16.0~dev-420-gc007a39