gomsun2 0 Posted October 31, 2023 I'm currently working on a MacBook Pro equipped with an M2 chip and using Parallels for virtualization to run Windows 11 ARM. I've encountered a peculiar issue. When I compile for 32bit, I'm not getting the result I anticipate. The code should produce an output of '3.0', but it consistently returns '0'. Here's a snippet of the code causing the problem: procedure TMainView.Button3Click(Sender: TObject); begin var LValue: UInt64 := 3; Caption := LValue.ToDouble.ToString; end; I've found this to be consistent across several Delphi versions, specifically D10, D11, and D12. Has anyone else experienced this issue, or can offer any insight? Share this post Link to post
Lajos Juhász 293 Posted October 31, 2023 You should try to debug the code. On an Intel Windows laptop I get the correct result '3'. Share this post Link to post
David Heffernan 2345 Posted October 31, 2023 I've seen other reports similar to this. It smells like an emulator bug. 1 Share this post Link to post
gomsun2 0 Posted October 31, 2023 (edited) 25 minutes ago, Lajos Juhász said: You should try to debug the code. On an Intel Windows laptop I get the correct result '3'. When I switch to debugging mode, the evaluation result is still the same. It represents 0. I don't have an Intel Mac for testing. However, when I asked my coworker to check on theirs, the issue was not replicated. It seems this might be specific to Mac with the M-series processor running Winodws 11 ARM. Edited October 31, 2023 by gomsun2 Share this post Link to post
gomsun2 0 Posted October 31, 2023 20 minutes ago, David Heffernan said: I've seen other reports similar to this. It smells like an emulator bug. I agree, I reported it to the quality portal: https://quality.embarcadero.com/browse/RSB-7079 Share this post Link to post
Lajos Juhász 293 Posted October 31, 2023 59 minutes ago, gomsun2 said: I agree, I reported it to the quality portal: https://quality.embarcadero.com/browse/RSB-7079 In my opinion this is the wrong place to report the error. Delphi compiles the code correctly, your environment is giving the wrong result eg. it's not a compiler bug. Share this post Link to post
Arnaud Bouchez 407 Posted October 31, 2023 Perhaps the FPU/x87 is not well supported within the emulator. IIRC the 32-bit Delphi RTL uses the FPU to make double-to-string conversion, using BCD conversions https://www.felixcloutier.com/x86/fbstp 1 Share this post Link to post
David Heffernan 2345 Posted October 31, 2023 Well I'd not want to use rtl code to convert float to string anyway because it doesn't get it right for all floats Share this post Link to post
eivindbakkestuen 47 Posted November 2, 2023 Compiling for 64 bit works, I presume? Share this post Link to post