View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0038489 | FPC | RTL | public | 2021-02-15 11:54 | 2021-03-22 14:41 |
Reporter | brick08 | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | always |
Status | new | Resolution | open | ||
Platform | Win64 | OS | Windows | ||
Product Version | 3.2.0 | ||||
Summary | 0038489: FormatBCD with DisplayFormat = '0.#' and integer values | ||||
Description | function FormatBCD ( const Format : string; BCD : tBCD ) : FmtBCDStringtype in unit FmtBCD with Format = '0.#' and BCD as integer value, then result output with thousand separator. | ||||
Steps To Reproduce | procedure testFormatBCD; var bcd: TBCD; s: String; begin bcd := StrToBCD('0'); s := FormatBCD('0.#', bcd); WriteLn(s); end; The result looks like this: '0.' Correctly it should look like without thousand separator: '0' | ||||
Tags | FmtBCD | ||||
Fixed in Revision | |||||
FPCOldBugId | |||||
FPCTarget | |||||
Attached Files |
|
|
Possible patch attached + updated unti test tfmtbcd.pp.diff (307 bytes)
--- tfmtbcd.pp.ori Wed Feb 24 14:15:56 2021 +++ tfmtbcd.pp Wed Feb 24 14:14:37 2021 @@ -253,6 +253,7 @@ bcd:=strtobcd('0'); testFormatBCD('0;;0',bcd, '0'); testFormatBCD('0;;#',bcd, ''); + testFormatBCD('0;;0.#',bcd, '0'); testFormatBCD('0;;0.00',bcd, '0.00'); // test StrToBCD: |
|
fmtbcd.pp.diff (759 bytes)
--- fmtbcd.pp.ori Wed Feb 24 12:39:27 2021 +++ fmtbcd.pp Wed Feb 24 14:42:44 2021 @@ -2835,10 +2835,12 @@ PFmt := Section.FmtDS; // start from decimal point until end i := length(BCDStr) - Scale + ord(Scale=0); dec(j1, Section.FmtEnd-Section.FmtDS); - j := j1 + 1; + j := j1 + 1; // points to decimal separator in output buffer while PFmt < Section.FmtEnd do PutFmtDigit(PFmt, i, j, 1); - je := j; // store position after last decimal digit + if j-j1=2 then // alone decimal separator at end of output buffer + dec(j); + je := j; // store position after last decimal digit (or any constant character) in output buffer end; // output whole number part of BCDStr |
Date Modified | Username | Field | Change |
---|---|---|---|
2021-02-15 11:54 | brick08 | New Issue | |
2021-02-24 14:20 | LacaK | Note Added: 0129142 | |
2021-02-24 14:20 | LacaK | File Added: fmtbcd.pp.diff | |
2021-02-24 14:20 | LacaK | File Added: tfmtbcd.pp.diff | |
2021-02-24 14:21 | LacaK | Note Edited: 0129142 | View Revisions |
2021-02-24 14:27 | LacaK | File Deleted: fmtbcd.pp.diff | |
2021-02-24 14:44 | LacaK | File Deleted: fmtbcd.pp.diff | |
2021-02-24 14:44 | LacaK | Note Added: 0129144 | |
2021-02-24 14:44 | LacaK | File Added: fmtbcd.pp.diff | |
2021-03-22 14:41 | LacaK | Tag Attached: FmtBCD |