Here’s a little bit of code:

REPORT.

DATA a TYPE f.
DATA b TYPE f.
a = '0.1'.
b = '0.2'.
DATA c TYPE f.
c = a + b.
WRITE / c.

Output is… 3,0000000000000004E-01 (i.e. 0.300 000 000 000 000 04)

Add a couple more WRITE statements and you might begin to see what’s going on.

1.0000000000000001E-01
2.0000000000000001E-01
3.0000000000000004E-01

For a full explanation (and what put me onto this) see here. It’s kind of obvious, once you think about, but it never really occured to me!

Sara Sampaio

Sara Sampaio

Author Since: March 10, 2022

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x