mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-09 12:26:07 +02:00
* fixed FormatFloat for non-x86 (mantis 9384)
git-svn-id: trunk@8220 -
This commit is contained in:
parent
4cdd590091
commit
49a545aef2
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -8367,6 +8367,7 @@ tests/webtbs/tw9299.pp -text
|
|||||||
tests/webtbs/tw9306a.pp -text
|
tests/webtbs/tw9306a.pp -text
|
||||||
tests/webtbs/tw9306b.pp -text
|
tests/webtbs/tw9306b.pp -text
|
||||||
tests/webtbs/tw9309.pp -text
|
tests/webtbs/tw9309.pp -text
|
||||||
|
tests/webtbs/tw9384.pp svneol=native#text/plain
|
||||||
tests/webtbs/ub1873.pp svneol=native#text/plain
|
tests/webtbs/ub1873.pp svneol=native#text/plain
|
||||||
tests/webtbs/ub1883.pp svneol=native#text/plain
|
tests/webtbs/ub1883.pp svneol=native#text/plain
|
||||||
tests/webtbs/uw0555.pp svneol=native#text/plain
|
tests/webtbs/uw0555.pp svneol=native#text/plain
|
||||||
|
@ -1970,11 +1970,13 @@ Var
|
|||||||
Str(Value:Width+8,Digits);
|
Str(Value:Width+8,Digits);
|
||||||
{ Find and cut out exponent. Always the
|
{ Find and cut out exponent. Always the
|
||||||
last 6 characters in the string.
|
last 6 characters in the string.
|
||||||
-> 0000E+0000 }
|
-> 0000E+0000
|
||||||
I:=Length(Digits)-5;
|
*** No, not always the last 6 characters, this depends on
|
||||||
Val(Copy(Digits,I+1,5),Exp,J);
|
the maximally supported precision (JM)}
|
||||||
|
I:=Pos('E',Digits);
|
||||||
|
Val(Copy(Digits,I+1,255),Exp,J);
|
||||||
Exp:=Exp+1-(Placehold[1]+Placehold[2]);
|
Exp:=Exp+1-(Placehold[1]+Placehold[2]);
|
||||||
Delete(Digits, I, 6);
|
Delete(Digits, I, 255);
|
||||||
{ Str() always returns at least one digit after the decimal point.
|
{ Str() always returns at least one digit after the decimal point.
|
||||||
If we don't want it, we have to remove it. }
|
If we don't want it, we have to remove it. }
|
||||||
If (Decimals=0) And (Placehold[1]+Placehold[2]<= 1) Then
|
If (Decimals=0) And (Placehold[1]+Placehold[2]<= 1) Then
|
||||||
|
11
tests/webtbs/tw9384.pp
Normal file
11
tests/webtbs/tw9384.pp
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
program test_formatloat;
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
uses
|
||||||
|
SysUtils;
|
||||||
|
var
|
||||||
|
ef : Extended;
|
||||||
|
begin
|
||||||
|
ef := 12;
|
||||||
|
if (FormatFloat('#.#######E-0',ef) <> '1.2E1') then
|
||||||
|
halt(1);
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user