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!
Subscribe
Login
Please login to comment
0 Comments