Re: FastCode RoundToEx



Hi John

<By observation, I do the arithmetic to calc the abs value of the difference
between the numbers and 0.05 (=5/100):

<Abs(RoundTo_JFH - 5/100) = 0.00000 00000 00000 00000 06776 26357 80344
02712 54658 00054 37135 69641 11328 125

<Abs(RoundToEX_Ref - 5/100) = 0.00000 00000 00000 00000 27105 05431 21376
10850 18632 00217 48542 78564 45312 5

<Here you can see that the RoundToEX_Ref result is about three times farther
away from the 5/100 target than the RoundTo_JH result.

I get an error of -3,388131789e-21 in the B&V with this function

function Validate4 : Boolean;
var
X, Y1, Y2 : Extended;
Digits : TRoundToEXRangeExtended;
const
ValidateNo : Integer = 4;

begin
Result := True;
Digits := -2;
X := 5/100;
Y1 := RoundToEX_Ref(X, Digits);
Y2 := RoundToEXFunction(X, Digits);
if Abs((Y1 - Y2) / Y1) > EXTENDEDLIMIT then
begin
ErrorTrap(ValidateNo, Digits, X);
Result := False;
end;
end;

which is below our limit 1,0842021725e-19

Is that limit proper?

Best regards
Dennis Kjaer Christensen


.