diff options
author | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2020-09-05 18:44:57 +0000 |
---|---|---|
committer | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2020-09-05 18:44:57 +0000 |
commit | c6e9e60c51b8920ca55e341c4fd8b0ad8ec64b13 (patch) | |
tree | dbcb879f939721a8b74ee793b9f89a32e43dcbae /rtl/objpas | |
parent | d07c29a743265ed7b86e2f880298db9a09c8f981 (diff) | |
download | fpc-c6e9e60c51b8920ca55e341c4fd8b0ad8ec64b13.tar.gz |
* fix formatfloat for 0 in exponential format (based on patch by
Jamie Philbrook, mantis #37374)
git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@46778 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'rtl/objpas')
-rw-r--r-- | rtl/objpas/sysutils/fmtflt.inc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/rtl/objpas/sysutils/fmtflt.inc b/rtl/objpas/sysutils/fmtflt.inc index 999908261f..2c6c5802ea 100644 --- a/rtl/objpas/sysutils/fmtflt.inc +++ b/rtl/objpas/sysutils/fmtflt.inc @@ -298,11 +298,13 @@ var Function FormatExponent(ASign: FChar; aExponent: Integer) : FString; begin - Result:=IntToStr(aExponent); + if E = 0 then + aExponent := 0; + Result:=IntToStr(Abs(aExponent)); Result:=StringOfChar('0',ExpSize-Length(Result))+Result; if (aExponent<0) then Result:='-'+Result - else if (aExponent>0) and (aSign='+') then + else if (aExponent>=0) and (aSign='+') then Result:=aSign+Result; end; @@ -383,7 +385,12 @@ begin Inc(I); end; end; - end; + end + else if I< SectionLength Then + begin + inc(I); + ToResult(Section[i]); + end; end; else ToResult(C); |