Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Comparison QB64 compiled with gcc optimizations and without
#56
Errors with binary math meaning errors occur when we use computer binary math to represent base 10 output. So it's not the language, it's the principle. For instance, try running the following...

Code: (Select All)
DIM j AS SINGLE
FOR i = 1 TO 10
    j = 1 / 10 + j
    PRINT i, j
NEXT
PRINT

FOR i = 1 TO 100
    j = .01 * i
    PRINT i, j
    SLEEP
NEXT
DIM k AS DOUBLE
CLS
FOR i = 1 TO 10
    k = 1 / 10 + k
    PRINT i, k
NEXT
PRINT

FOR i = 1 TO 100
    k = .01 * i
    PRINT i, k
    SLEEP
NEXT

You will see inaccuracies in both DIM models. So the computer counts in base 2, whatever the language. The only way around it is to make a math library for the language to access.

Pete
Reply


Messages In This Thread
RE: Comparison QB64 compiled with Ofast and without - by Pete - 08-15-2022, 08:25 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  niXman gcc-13.1.0 Jack 8 1,851 10-04-2023, 12:51 PM
Last Post: a740g
  BASIC's Comparison Matrix: ideas for content? CharlieJV 28 6,747 10-03-2022, 01:27 AM
Last Post: CharlieJV
  String comparison oddity...[SOLVED] Pete 6 1,298 08-05-2022, 07:16 PM
Last Post: Pete
  Found a BUG with the QB64 editor compiled with the -O3 option Coolman 2 829 06-02-2022, 06:27 PM
Last Post: Coolman

Forum Jump:


Users browsing this thread: 1 Guest(s)