A ajk Active Member Licensed User Longtime User Jun 20, 2018 #1 I have Dim CenaDBL,RownaSieDBL, KrotnoscDBL, StaraKrotnoscDBL As Double then in code: RownaSieDBL = KrotnoscDBL*CenaDBL I got: CenaDBL=2.2 KrotnoscDBL=99999.0 RownaSieDBL=219997.80000000002 Something went wrong?
I have Dim CenaDBL,RownaSieDBL, KrotnoscDBL, StaraKrotnoscDBL As Double then in code: RownaSieDBL = KrotnoscDBL*CenaDBL I got: CenaDBL=2.2 KrotnoscDBL=99999.0 RownaSieDBL=219997.80000000002 Something went wrong?
S sorex Expert Licensed User Longtime User Jun 20, 2018 #2 smells like a typical floating point issue. round it to 2 values behind the comma?
Erel B4X founder Staff member Licensed User Longtime User Jun 20, 2018 #3 sorex said: round it to 2 values behind the comma? Click to expand... Never use Round2. Use NumberFormat when you want to show the value. Binary floating point numbers cannot accurately represent decimal numbers. You should expect small errors.
sorex said: round it to 2 values behind the comma? Click to expand... Never use Round2. Use NumberFormat when you want to show the value. Binary floating point numbers cannot accurately represent decimal numbers. You should expect small errors.