fpspreadsheet: Fix error in Round function. Add a second unit test for Round.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6217 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2018-02-27 22:21:49 +00:00
parent 8976969236
commit 022b837553
4 changed files with 35 additions and 11 deletions

View File

@@ -315,7 +315,7 @@ begin
n := Args[1].ResInteger
else
n := round(Args[1].ResFloat);
Result := FloatResult(RoundTo(ArgToFloat(Args[0]), n));
Result := FloatResult(RoundTo(ArgToFloat(Args[0]), -n));
end;
procedure fpsSIGN(var Result: TsExpressionResult; const Args: TsExprParameterArray);

View File

@@ -2963,6 +2963,7 @@ procedure TsSpreadOpenDocReader.ReadNumFormats(AStylesNode: TDOMNode);
nf: TsNumberFormat;
nfs: String;
decs: Byte;
sint: String;
s: String;
f: Double;
fracInt, fracNum, fracDenom: Integer;
@@ -2986,6 +2987,9 @@ procedure TsSpreadOpenDocReader.ReadNumFormats(AStylesNode: TDOMNode);
end else
if nodeName = 'number:number' then
begin
sint := GetAttrValue(node, 'number:min-integer-digits');
if sint = '' then sint := '1';
s := GetAttrValue(node, 'number:decimal-places');
if s = '' then
s := GetAttrValue(node, 'decimal-places');
@@ -3000,7 +3004,7 @@ procedure TsSpreadOpenDocReader.ReadNumFormats(AStylesNode: TDOMNode);
s := GetAttrValue(node, 'number:display-factor');
if s <> '' then f := StrToFloat(s, FPointSeparatorSettings) else f := 1.0;
nf := IfThen(grouping, nfFixedTh, nfFixed);
nfs := nfs + BuildNumberFormatString(nf, Workbook.FormatSettings, decs);
nfs := nfs + BuildNumberFormatString(nf, Workbook.FormatSettings, decs); //, StrToInt(sint));
if f <> 1.0 then begin
nf := nfCustom;
while (f > 1.0) do