Ansicht
Dokumentation
Tip-No.: 2541 ( INFO2541 )
Compare to '=' for floating point figures
Tip-No.: 2541
( INFO2541 )
BAL Application Log Documentation
BAL Application Log Documentation
This documentation is copyright by SAP AG.
Short text
Compare to '=' for floating point figures
Tip-No.: 2541
Symptom
Two floating point numbers should be equal or appear "equal" (e.g.
after WRITE), but the = test has not been met.
Cause
Due to fundamentally occurring rounding errors in F-arithmatic, the
last digits (those furthest to the right) are often not exaxt. This
is not only true for the result of long invoices, but also if an
operand has come from a different data type via conversion.
Solution
It often makes more sense to test whether the relative error is less
than the appropriate error margin instead of testing for equality.
Therefore:
-e <= ( F - G ) / G <= e.
CL_GUI_FRONTEND_SERVICES - Frontend Services BAL Application Log Documentation
This documentation is copyright by SAP AG.
Length: 815 Date: 20240424 Time: 223307 sap01-206 ( 11 ms )