"Has anybody an explanation?"
The simple explanation is: log10(a) is not exactly representable using a binary floating point number.
Any operations on binary floating point numbers can accumulate floating point error. It is the author's responsibility to understand this and take into account the finite precision of all numeric calculations and the results.
Question: can the value b be exactly represented by a finite binary number? (hint: no)
Question: what happens to this floating point error when you perform operations on that value? (hint: it accumulates)
"It is important for my calculation, that it ends up with exactly the same value."
That is not how numeric computing works. Computers do not have infinite memory, so you cannot expect them to store infinite precision numeric data. It is exactly the same as if I ask you to write 1/3 as a decimal fraction on a piece of paper. Then perform some arithmetic operations on the number that you have written down (not on the fraction 1/3): does the result of those operations have infinite precision? (hint: no, it is limited to what you could write down).
If you really want to work with exactly the same value then you could use symbolic variables/operations. But this is more complex and much slower than numeric computations.
s = sym(14.25)
s =
t = simplify(10^(log10(s)))
t =
Best Answer