zserio icon indicating copy to clipboard operation
zserio copied to clipboard

Improve floats comparison in generated code

Open mikir opened this issue 2 years ago • 0 comments

Although floats comparison in zserio expressions are forbidden, there are still floats comparisons in generated code in equality operator and in parameter check. Such float comparison in generated code in all languages is implemented by simple quality operator.

This should be changed to compare the absolute difference between the floats and minimum float number (epsilon). This will solve potential wrong float comparisons, e.g. (0.3 * 3) + 0.1 != 1.0.

mikir avatar Mar 23 '22 07:03 mikir