Author Topic: I don't often work with numbers, but when I do....  (Read 6430 times)

0 Members and 1 Guest are viewing this topic.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: I don't often work with numbers, but when I do....
« Reply #30 on: September 16, 2021, 09:35:44 pm »
This works with unsimplified too:
Code: QB64: [Select]
  1. _ScreenMove 100, 0: Width 80, 42
  2. a = .01
  3. b = 32767
  4. For j = 1 To 120
  5.     b = b + a
  6.     r = Round##(b, 2)
  7.     Print j; r
  8.     ' IF j MOD 40 = 0 THEN SLEEP
  9.  
  10.  
  11. Function Round## (num As Double, digits As Long) 'unsimplified
  12.     Round## = Int((num + .5 * 10 ^ -digits) * 10 ^ digits) / 10 ^ digits
  13.