Casting Int64 to Double doesn't convert on mode Delphi

Original Reporter info from Mantis: marcelo_rocha
  • Reporter name: Marcelo Campos Rocha

Description:

The Release notes from FPC 3.0(https://wiki.freepascal.org/User_Changes_3.0#Casting_integer_variables_to_floating_point) describes a new behavior where
explicit typecasting from Int64 to Double results in a conversion. I've observed that this behavior happens on objfpc mode, but not on delphi mode. It's not the expected, because Delphi's compiler does the same conversion when doing explicit typecasting.

Steps to reproduce:

program project1;

{$mode objfpc}

uses
  SysUtils;

var
  f: Double;
  n: Int64;

begin
  n := 9876543210;
  f := Double(n);
  writeln(f);
end.

Mantis conversion info:

  • Mantis ID: 35886
  • Version: 3.2.0
  • Fixed in version: 3.3.1
  • Fixed in revision: 42507 (#1da43f67)