Equal To Operator (==) (FPScript)
Compares two numeric expressions and returns TRUE if the left expression is equal to the right expression.
Syntax
Expression1 == Expression2
The syntax of the == operator consists of the following elements:
Element |
Description |
---|---|
Expression1 |
Any expression. All data types are permitted. |
Expression2 |
Same as Expression1. |
Remarks
The operator can process scalar values or entire data series and data matrices. If at least one argument is a data series or a data matrix, the comparison takes place on a per-element basis and the result is once again a data series or a data matrix with Boolean values. If at least one of the two arguments is a data matrix, then both arguments must have the same number of rows. For a different number of columns in data matrices or for a different number of rows in data series, extra columns or values are ignored.
For signals, signal series and space curves, only the Y component is examined and the result has the same data structure as the Y component of the arguments. If one of the expressions returns a list, then the operation is executed for each item in the list and the result is also a list.
If both expressions are strings, then these are lexicographically compared, taking upper and lower case into account. If only one argument is a string, the string is converted before the operation into the data type of the other operand. If one of the operands is void, then the result is always FALSE, but if both are void, then the result is TRUE. You can use the operator to test for the Empty data type.
If Expression1 and Expression2 are a quantity, then they have to have the same SI dimension and the unit of Expression2 is transformed before being compared to the unit of Expression1 . If only one argument is a quantity, then the same unit is used for the other argument.
Notes:
•A common error is to mistake the Equal To operator (==) for the Assignment operator(=). Please check your code carefully for this.
•If you apply the Equal To operator to floating point values, then it only returns TRUE if these are exactly identical, which is rarely the case. Instead, you should use a comparison with the format Absolute(a - b) < 0.0001.
Available in
FlexPro View, Basic, Professional, Developer Suite
Examples
Boolean Minimum(Integer16(DataSeries1 == DataSeries2)) |
Returns TRUE if all values in the two data series match exactly. |
"FlexPro" == "FlexPro2" |
Returns FALSE. |
"FlexPro" == "Flexpro" |
Returns FALSE. |
? == 1 |
Returns FALSE. |
? == ? |
Returns TRUE. |
Variable == Empty |
Returns TRUE if Variable is empty. |
1 V == 1000 mV |
Returns TRUE. |