Closed GoogleCodeExporter closed 9 years ago
Currency has the same Problem. Double uses some externel gcvt function, but
currency uses the CurrToStr. So its easy to fix:
Move SetLength(Result, len+1);
After if c <> 0 then
Correct Code:
Result := IntToStr(Abs(PInt64(@c)^));
len := Length(Result);
if c <> 0 then
begin
SetLength(Result, len+1);
Original comment by jas...@trollgames.de
on 23 Sep 2011 at 8:57
There are more errors 100 will also produce an 100.
Don't know whar stuff CurrToStr is doing. For now an Exit after Result :=
IntToStr(Abs(PInt64(@c)^)); works fine
Original comment by jas...@trollgames.de
on 23 Sep 2011 at 9:45
well not quite good, didn't look right inttostr cuts of everything after the
comma.
so just do
function CurrToStr(c: Currency): SOString;
var
formatSettings: TFormatSettings;
begin
formatSettings.DecimalSeparator := '.';
Result:=FloatToStr(c,formatSettings);
end;
Original comment by jas...@trollgames.de
on 23 Sep 2011 at 12:45
[deleted comment]
1. Put the below function just under the gcvt definition.
function FloatToStr(c: Double): SOString;
var
fbuffer: array[0..31] of AnsiChar;
begin
Result := SOString(gcvt(c, 15, fbuffer));
if (Result[length(Result)] = '.') then result := result + '0';
end;
2. Replace -> Result := Append(PSOChar(SOString(gcvt(FO.c_double, 15,
fbuffer))));
with -> Result := Append(PSOChar(FloatToStr(FO.c_double)));
Original comment by omercio...@gmail.com
on 12 Jun 2013 at 10:13
Original issue reported on code.google.com by
lizhen...@gmail.com
on 21 Feb 2011 at 3:49