How To

Why and how does this happen


412lop 2023-05-26 12:21

This program adds 0.1 to a value and prints that value, but some times it says something like “2.99997”. So why does this happen.

was8bit 2023-05-26 14:18

Its a decimal rounding issue... common for computers...

If you REALLY need the numbers you expect, stick to whole numbers...

was8bit 2023-05-26 14:21

Log in to reply.