Skip to content

FormatFloat('0.#',NaN) raises SigFPE instead of returning "NaN"

Original Reporter info from Mantis: Andre Schulze
  • Reporter name: André Schulze

Description:

When passing NaN to FormatFloat, a floating point exception is raised. In Delphi 7 this function returns a string like "NaN".

I would prefer to get a string instead of an exception.

Steps to reproduce:

program project1;

{$mode objfpc}{$H+}

uses
  Math,SysUtils;

begin
  WriteLn(FormatFloat('0.#',Nan));
end.
                  

Mantis conversion info:

  • Mantis ID: 32868
  • Version: 3.0.4
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information