Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simple Addition gone wrong
#6
Code: (Select All)
FOR I! = 0 TO 1 STEP .0000001
  itot! = itot! + I!
  PRINT "I : ", I!, "I Total : ", itot!

NEXT

It takes a few seconds to run but if you analyse the numbers youll see how adding/incrementing any floating point numbers (and this is in almost any language) will never yield absolute results...I had a similar problem years ago and Galleon tried to explain it to me, all i remember is...two floating point variables that are both .5 when added together do not guarantee the result is 1!

Dont know if that helps!

John
Reply


Messages In This Thread
Simple Addition gone wrong - by Dimster - 08-20-2025, 08:27 PM
RE: Simple Addition gone wrong - by bplus - 08-20-2025, 08:31 PM
RE: Simple Addition gone wrong - by ahenry3068 - 08-20-2025, 09:14 PM
RE: Simple Addition gone wrong - by SMcNeill - 08-20-2025, 11:15 PM
RE: Simple Addition gone wrong - by ahenry3068 - 08-20-2025, 11:47 PM
RE: Simple Addition gone wrong - by Unseen Machine - 08-21-2025, 03:31 AM
RE: Simple Addition gone wrong - by bplus - 08-21-2025, 06:30 AM
RE: Simple Addition gone wrong - by SMcNeill - 08-21-2025, 04:51 AM
RE: Simple Addition gone wrong - by Dimster - 08-21-2025, 03:09 PM
RE: Simple Addition gone wrong - by bplus - 08-21-2025, 03:45 PM
RE: Simple Addition gone wrong - by SMcNeill - 08-21-2025, 04:09 PM
RE: Simple Addition gone wrong - by bplus - 08-21-2025, 07:16 PM
RE: Simple Addition gone wrong - by Jack - 08-21-2025, 09:38 PM
RE: Simple Addition gone wrong - by Pete - 08-22-2025, 09:00 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Nice simple, I hope, question Mad Axeman 4 333 12-20-2025, 09:28 PM
Last Post: SMcNeill
  Trying to create a simple menu CMR 8 1,188 06-18-2025, 06:59 PM
Last Post: CookieOscar
  What is wrong with this for/next loop Helium5793 6 1,120 04-15-2025, 05:11 PM
Last Post: Kernelpanic
  Either I'm doing MID$( wrong or it has a bug TDarcos 4 798 04-13-2025, 11:14 PM
Last Post: TDarcos
  Simple Brick Pattern Fill Question NakedApe 3 892 12-01-2023, 09:37 PM
Last Post: NakedApe

Forum Jump:


Users browsing this thread: