Log On
Embarcadero Home
Watch, Follow, &
Connect with Us
Share This
QualityCentral
Communities
Articles
Blogs
Resources
Downloads
Help
QualityCentral
Delphi-BCB
RTL
Delphi
Arithmetic
ConvUtils
Date - Time
DateUtils
File Management
Format + Float
Input/Output
Math Unit
Memory, Pointer, Address
Null-terminated strings
Other Classes
Other RTL
Pascal Strings
Regular Expressions
RTL Exceptions
Text Files
Thread support
Typed/Untyped Files
WinAPI
You are not logged in.
Help
Print
Public Report
Report From:
Delphi-BCB/RTL/Delphi/Format + Float
[ Add a report in this area ]
Report #:
102074
Status:
Closed
[Regression in XE2] FormatBcd() formats incorrectly
Project:
Delphi
Build #:
16.0.4358.45540
Version:
16.3
Submitted By:
Jose Luis Rocha
Report Type:
Basic functionality failure
Date Reported:
12/23/2011 2:26:20 PM
Severity:
Serious / Highly visible problem
Last Updated:
3/20/2012 2:24:39 AM
Platform:
All platforms
Internal Tracking #:
289275
Resolution:
Fixed
(Resolution Comments)
Resolved in Build:
:
Update 4
Duplicate of:
None
Voting and Rating
Overall Rating:
No Ratings Yet
0.00 out of 5
Total Votes:
9
Description
FormatBcd incorrectly returns a extra dot character with '0.##' mask and numbers without decimals.
ej.:
FormatBcd('0.##', 1.0) output: '1.' (with a final dot)
This bug affects to the DisplayFormat of TBcdFields and TFmtBcdFields.
//USc: This is regression from XE.
Steps to Reproduce:
By USc:
- dcc QC102074.dpr
- execute QC102074
expected: output is PASS
actual:
FAIL #1 Expected: "1" Actual: "1."
FAIL
program QC102074;
{$APPTYPE CONSOLE}
uses
SysUtils, FMTBcd;
var
Counter: Integer;
S: string;
Bcd: TBcd;
begin
FormatSettings.DecimalSeparator := '.';//make test #2 pass on non US systems
Counter := 0;
Bcd := DoubleToBcd(1.0);
S := FormatBcd('0.##', Bcd);
if S = '1' then
Inc(Counter)
else
WriteLn('FAIL #1 Expected: "1" Actual: "', S, '"');
Bcd := DoubleToBcd(1.23);
S := FormatBcd('0.##', Bcd);
if S = '1.23' then
Inc(Counter)
else
WriteLn('FAIL #2 Expected: "1.23" Actual: "', S, '"');
if Counter = 2 then
WriteLn('PASS')
else
WriteLn('FAIL');
end.
Original steps:
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessage(FormatFloat('0.##', 1.0)); // output: '1'
ShowMessage(FormatCurr('0.##', 1.0)); // output: '1'
ShowMessage(FormatBcd('0.##', 1.0)); // output: '1.' (with dot)
end;
Workarounds
None
Attachment
None
Comments
Tomohiro Takahashi at 12/24/2011 4:50:58 AM
-
Is this a regression in XE2 (Update 3)?
What about previous versions of Delphi?
Lars Meyer at 12/24/2011 8:39:23 AM
-
Update#2 has the same behavior.
Jose Luis Rocha at 3/7/2012 12:21:14 PM
-
Fixed in Upd 4.
Tomohiro Takahashi at 3/7/2012 5:25:13 PM
-
Thanks for the confirmation.
yes, this issue is fixed in Update 4.
http://edn.embarcadero.com/article/42090
View Your Reports
Search
Server Response from: ETNACODE01
Developer Tools
Blackfish SQL
C++Builder
Delphi
FireMonkey
Prism
InterBase
JBuilder
J Optimizer
HTML5 Builder
3rdRail & TurboRuby
Database Tools
Change Manager
DBArtisan
DB Optimizer
ER/Studio
Performance Center
Rapid SQL
Technical Articles
Tutorials
White Papers
Press Releases
Newsletters
Add Content (GetPublished)
Audio
Audio & Video
Video
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Tags
Technology Partners
Downloads
Free Trials
Registered User Downloads
Beta Programs
Add Content (GetPublished)
Articles
Blogs
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Member Services
About
Connect with Us