Different implicit typecasting with different backends

Everything else that doesn't fall into one of the other PB categories.
Little John
Addict
Addict
Posts: 4519
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Different implicit typecasting with different backends

Post 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.
User avatar
skywalk
Addict
Addict
Posts: 3972
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Different implicit typecasting with different backends

Post 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
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Little John
Addict
Addict
Posts: 4519
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Different implicit typecasting with different backends

Post by Little John »

Interesting. Thanks!
Post Reply