Posts: 3
Threads: 1
Joined: May 2025
Reputation:
0
Hi all, new to the forum, new to QB64, but have done some coding in QB.
I have a general question on the math capabilities available. I am tied down rright now to a 32-bit Win 11 machine. I would like to do some math operations using 64-bit integers. Will QB 64 be able to give me the full precision of the 64-bits? I realize that I will lose speed on the thunking from 32 to 64 bits, but I can always recompile and run on a 64-bit machine when I get access to one.
I want to start coding again since I have some forced free time so expect some more general under-the-hood type questions.
Posts: 3,011
Threads: 353
Joined: Apr 2022
Reputation:
284
You're fine -- both on the asking as many questions needed part and the math part as well. We're happy to help and encourage folks to ask any questions they might have; no one here ever complains over stupid questions. *Though we do complain about Pete, but that's a different type of stupid...*
As for the math issue, it's not an issue. Your 32-bit machine should run and handle 64-bit math and such with the same precision and results as 64-bit systems. In fact, most math is done on FPU math processors, with are 80-bit math handling, instead of 32 or 64! You're welcome to post some simple test code and ask folks to share their results so you can see the precision doesn't change on your system, but I'm fairly certain you'll get the same answers between 32 and 64-bit systems.
(One caveat -- ARM systems seem to be limited to less precison than x86 or x64 systems, but you didn't ask about those. If anyone is curious, feel free to ask @a470g about the differences, as he's just spent the last few weeks working them out so QB64PE will soon start compiling on ARM systems without many problems.)
Posts: 471
Threads: 37
Joined: Apr 2022
Reputation:
37
05-29-2025, 01:27 PM
(This post was last modified: 05-29-2025, 01:28 PM by Jack.)
arm64 as is used on the Pi 5 and with 64-bit Pi OS has a 128-bit long double type, though that type is probably not available in QB64
Posts: 417
Threads: 23
Joined: May 2022
Reputation:
79
05-29-2025, 11:18 PM
(This post was last modified: 05-29-2025, 11:21 PM by a740g.)
(05-29-2025, 01:27 PM)Jack Wrote: arm64 as is used on the Pi 5 and with 64-bit Pi OS has a 128-bit long double type, though that type is probably not available in QB64
That has to be emulated support because ARM says there is no hardware support for it - https://developer.arm.com/documentation/ka004751/1-0
If the underlying C++ compiler / RTL supports 128-bit long double, then QB64-PE will support it as well.
(05-29-2025, 10:37 AM)FCS_coder Wrote: Hi all, new to the forum, new to QB64, but have done some coding in QB.
I have a general question on the math capabilities available. I am tied down rright now to a 32-bit Win 11 machine. I would like to do some math operations using 64-bit integers. Will QB 64 be able to give me the full precision of the 64-bits? I realize that I will lose speed on the thunking from 32 to 64 bits, but I can always recompile and run on a 64-bit machine when I get access to one.
I want to start coding again since I have some forced free time so expect some more general under-the-hood type questions.
How are you running Windows 11 32-bit? As far as I know, Microsoft never released a 32-bit edition of Windows 11. Windows 10 was the last version to include one. Just curious.
Posts: 3,011
Threads: 353
Joined: Apr 2022
Reputation:
284
https://learn.microsoft.com/en-us/answer...ns-(32-and
Quote:No. Windows 11 exist in 64 bit only. There is no 32 bit version of Windows 11 available.
Posts: 3
Threads: 1
Joined: May 2025
Reputation:
0
Ooops, yeah, you're right. It's Win 10.
Funnily enough, it tells me I can't upgrade to 11, even though it keeps reminding me. If I had my choice, I'd be running 7, but never look a gift horse, etc, etc...
Posts: 471
Threads: 37
Joined: Apr 2022
Reputation:
37
@a740g
I figured that it was emulated, but now am curious how the QB84 _Float type will behave
Posts: 471
Threads: 37
Joined: Apr 2022
Reputation:
37
05-30-2025, 11:07 AM
(This post was last modified: 05-30-2025, 02:08 PM by Jack.)
OK, I modified qbs_str.cpp to output 34 significant digits for _Float and run the following test on Raspberry Pi 5 with Pi OS
Code: (Select All)
_Title "Float test-v1 by Jack"
$Console
_Dest _Console
Option _Explicit
Dim As _Float x, y, z
Dim As Long i
y = 9
Print " digits"
Print " 1234567891111111111222222222233333"
Print " 0123456789012345678901234"
For i = 1 To 10
x = i
z = x / y
Print Using "####"; i,
Print z
Next
x = 1
Print "Exp("; x; ") ="; Exp(x)
output
Code: (Select All) digits
1234567891111111111222222222233333
0123456789012345678901234
1 .1111111111111111111111111111111111
2 .2222222222222222222222222222222222
3 .3333333333333333333333333333333333
4 .4444444444444444444444444444444444
5 .5555555555555555555555555555555556
6 .6666666666666666666666666666666666
7 .7777777777777777777777777777777778
8 .8888888888888888888888888888888888
9 1
10 1.111111111111111111111111111111111
Exp( 1 ) = 2.718281828459045235360287471352662
exp is the only function that gives full precision
Posts: 471
Threads: 37
Joined: Apr 2022
Reputation:
37
the following works ok
Code: (Select All)
_Title "Float-test-v1-by-Jack"
$Console:Only
_Dest _Console
Option _Explicit
Declare Library
'Function snprintf& (dest As String, ByVal l As Long, frmt As String, ByVal x As _Float)
'Function sscanf& (s As String, frmt As String, x As _Float)
Function powl## (ByVal x As _Float, ByVal y As _Float)
Function sqrtl## (ByVal x As _Float)
Function sinl## (ByVal x As _Float)
Function cosl## (ByVal x As _Float)
Function tanl## (ByVal x As _Float)
Function asinl## (ByVal x As _Float)
Function acosl## (ByVal x As _Float)
Function atanl## (ByVal x As _Float)
Function logl## (ByVal x As _Float)
'Function expl## (ByVal x As _Float)
End Declare
Dim As _Float x, y, z
Dim As Long i
Dim As String s
For i = 1 To 10
x = i
z = sqrtl(x)
Print Using "#### "; i,
Print z
Next
x = 2
z = logl(x)
Print "Logl("; x; ") ="; z
y = Exp(z)
Print "Exp("; z; ") ="; y
x = 1234567891111111111222222222233333
Print x, "Wrong"
x = 1234567891111111111222222222233333.0
Print x, "OK"
x = Val("1234567891111111111222222222233333")
Print x, "Wrong"
x = Val("1234567891111111111222222222233333.0")
Print x, "OK"
x = 1
x = Exp(x)
y = 2
y = logl(y)
z = x ^ y
Print z, " x ^ y Works"
|