mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 13:29:14 +02:00
* fixed FloatToStrFIntl for platforms without extended
git-svn-id: trunk@5920 -
This commit is contained in:
parent
f7da932aa4
commit
d1c351462d
@ -1095,8 +1095,10 @@ End;
|
|||||||
const
|
const
|
||||||
{$ifdef FPC_HAS_TYPE_EXTENDED}
|
{$ifdef FPC_HAS_TYPE_EXTENDED}
|
||||||
maxdigits = 17;
|
maxdigits = 17;
|
||||||
|
maxexplen = 4;
|
||||||
{$else}
|
{$else}
|
||||||
maxdigits = 14;
|
maxdigits = 14;
|
||||||
|
maxexplen = 3;
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
Function FloatToStrFIntl(const Value; format: TFloatFormat; Precision, Digits: Integer; ValueType: TFloatValue; Const FormatSettings: TFormatSettings): String;
|
Function FloatToStrFIntl(const Value; format: TFloatFormat; Precision, Digits: Integer; ValueType: TFloatValue; Const FormatSettings: TFormatSettings): String;
|
||||||
@ -1197,7 +1199,7 @@ Begin
|
|||||||
If (Precision = -1) Or (Precision > maxdigits) Then Precision := maxdigits;
|
If (Precision = -1) Or (Precision > maxdigits) Then Precision := maxdigits;
|
||||||
case ValueType of
|
case ValueType of
|
||||||
fvDouble:
|
fvDouble:
|
||||||
Str(Double(Extended(Value)):Precision+7, Result);
|
Str(Double(Extended(Value)):Precision+8, Result);
|
||||||
fvSingle:
|
fvSingle:
|
||||||
Str(Single(Extended(Value)):Precision+6, Result);
|
Str(Single(Extended(Value)):Precision+6, Result);
|
||||||
fvCurrency:
|
fvCurrency:
|
||||||
@ -1222,7 +1224,10 @@ Begin
|
|||||||
if P <> 0 then
|
if P <> 0 then
|
||||||
begin
|
begin
|
||||||
Inc(P, 2);
|
Inc(P, 2);
|
||||||
while (Result[P] = '0') and (Digits < 4) do
|
{ the exponent length is shorted if extended is not supported }
|
||||||
|
if (Digits > maxexplen) then
|
||||||
|
insert(copy('0000',1,Digits-maxexplen),Result,P);
|
||||||
|
while (Result[P] = '0') and (Digits < maxexplen) do
|
||||||
begin
|
begin
|
||||||
System.Delete(Result, P, 1);
|
System.Delete(Result, P, 1);
|
||||||
if P > Length(Result) then
|
if P > Length(Result) then
|
||||||
|
Loading…
Reference in New Issue
Block a user