Page 1 of 1

Different implicit typecasting with different backends

Posted: Fri Jul 28, 2023 3:15 pm
by Little John
I have not done any systematic research. This is just an example that I stumbled across.

Code: Select all

; tested with PB 6.03 beta 3 (x64)

Define a.d, b.q

a = 2451544.5000115740113
b = (a - 2440587.5) * 86400

Debug b  ; ASM backend (Windows 11 and Linux Mint 20.3): 946684801
         ; C   backend (Windows 11 and Linux Mint 20.3): 946684800
 
Note: Using Round() yields consistent results.

Re: Different implicit typecasting with different backends

Posted: Fri Jul 28, 2023 3:38 pm
by skywalk
Good catch.
Correct answer if you stay in float and convert to quad last.

Code: Select all

; PB v603b3-x64 CBE+opt
Define a.d, b.d, c.q
a = 2451544.5000115740113
b = (a - 2440587.5) * 86400
c = b
Debug b  ; CBE 946684800.99999452
Debug c  ; CBE 946684801

Re: Different implicit typecasting with different backends

Posted: Fri Jul 28, 2023 5:22 pm
by Little John
Interesting. Thanks!