Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
computer adds .1 9 times and comes up with .8000001
#21
actually at 2bits I might be beat also. four works
Reply
#22
Just because it views in 32bits doesn't meen it can't handle a 64 bit problem. It just meens you have to "teach it".
Reply
#23
There are two solutions to this problem; both are very easy to implement. The first is to round your answer to the number of decimal points that you want:

Code:
CLS
DO
  PRINT USING "###.#"; b!;
  b! = b! + .1
  a% = a% + 1
LOOP UNTIL a% = 70

The second solution, which has already been posted by Nex, is to use fixed-point:

Code:
CONST DIV = 1000
CLS
DO
  PRINT b& / DIV,
  b& = b& + .1 * DIV
  a% = a% + 1
LOOP UNTIL a% = 70
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)