Currency converted bad float value.

Summary

System Information

  • Operating system: Windows 11
  • Processor architecture: x86-64
  • Compiler version: trunk
  • Device: Computer

Steps to reproduce

Set currency variable to '9500000.0004' and multiply by 10000.0 float value.

Example Project

program test_64_curr;

{$mode OBJFPC}
{$H+}

{$apptype console}

uses
  SysUtils;

var
  j: currency;
  i: int64;
  k: Double;

begin
  j:=9500000.0004;
  k:=10000.0;
  i:=Round(j * k); // works Round(Double(j) * k)
  writeln(i);      // 95000000004 expected
end.

What is the current bug behavior?

It shows -89467440733

What is the expected (correct) behavior?

95000000004 expected.

Relevant logs and/or screenshots

It related with #40914.

Possible fixes

Change default currency varibale type on Win64.
patch_win64_currency.diff

Edited by rasberryrabbit