LGF_CompareLRealByPrecision (FC / V3.0.1)


Author: Siemens Digital Industry

Short description

This function checks floating point numbers for equality, by using an approximation formula and a fixed precision by constant 1.0E-12 (pico)

Block Interface

LGF_CompareLRealByPrecision (FC)
LReal  valueA Ret_Val  Bool
    
LReal  valueB   
    
LReal  precision   
    
   

Input parameter

IdentifierData typeDescription
valueALRealFirst LREAL number to be compared.
valueBLRealSecond LREAL number to be compared.
precisionLRealAccuracy with which the two values are compared.

Output parameter

IdentifierData typeDescription
Ret_ValBoolFALSE: not equalTRUE: approximately the same

Functional description

The comparison of the LREAL numbers is based on an given accuracy at the parameter precision. The difference between the two input values must be smaller than the precision accuracy value multiplied by one of the two input values.

Equation:

result := ABS(valueA - valueB) <= (precision * ABS(valueA))

Change log

Version & DateChange description
01.00.00Simatic Systems Support
03.06.2019First released version
function besad on `LGF_CompareLReal`
03.00.00Simatic Systems Support
23.04.2020Set version to V3.0.0, harmonize the version of the whole library
03.00.01Simatic Systems Support
19.01.2020Insert documentation