mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-02 00:09:24 +01:00
based on the Grisu1 algorithm. This corrects several precision issues
with the previous code used to perform such conversions (patch by
Max Nazhalov, mantis #25241)
o adaptation of several tests to deal with the better precision of these
routines compared to the previous version
Please don't remove the real2str.inc file yet, it's still used by the
JVM target for now
git-svn-id: trunk@25888 -
28 lines
561 B
ObjectPascal
28 lines
561 B
ObjectPascal
uses
|
|
math;
|
|
var
|
|
s : string;
|
|
Begin
|
|
{$ifdef FPC_HAS_TYPE_EXTENDED}
|
|
str(intpower(2,63):25,s);
|
|
if s<>' 9.2233720368547758E+0018' then
|
|
begin
|
|
WriteLn(intpower(2,63));
|
|
halt(1);
|
|
end;
|
|
{$endif FPC_HAS_TYPE_EXTENDED}
|
|
|
|
{$ifdef FPC_HAS_TYPE_DOUBLE}
|
|
str(double(intpower(2,63)):22,s);
|
|
{$ifdef FPC_HAS_TYPE_EXTENDED}
|
|
if s<>' 9.22337203685478E+018' then
|
|
{$else FPC_HAS_TYPE_EXTENDED}
|
|
if s<>' 9.22337203685478E+018' then
|
|
{$endif FPC_HAS_TYPE_EXTENDED}
|
|
begin
|
|
WriteLn(double(intpower(2,63)));
|
|
halt(1);
|
|
end;
|
|
{$endif FPC_HAS_TYPE_DOUBLE}
|
|
end.
|