WOLFRAM SYSTEMMODELER

isEqual

Determine if two Real scalars are numerically identical

Wolfram Language

In[1]:=
SystemModel["Modelica.Math.isEqual"]
Out[1]:=

Information

This information is part of the Modelica Standard Library maintained by the Modelica Association.

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

Syntax

result = isEqual(s1, s2, eps)

Inputs (3)

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

Outputs (1)

result

Type: Boolean

Description: = true, if scalars are identical