Re: Fastcode RoundTo replacement




"Max" wrote
> there are offered these replacements in RoundToEX_JOH.pas:
> ... Which is recommended?

The original RoundTo() that came with D6 or D7 has
problems. Same are noted in still open QualityCentral
report #8070.

Perhaps, stating the definition of what the RoundTo function
is supposed to be doing (either by words or code) would be
a good place to start.

Beyond, what was originally noted in the #8070 report,
note that the ADigit in
function RoundTo
(const AValue: Double; const ADigit: TRoundToRange): Double;
which is defined as
type TRoundToRange = -37..37;
was probably meant to be
type TRoundToRange = -27..27;
because 10 raised to the 37th power cannot be exactly
represented in the data type extended. The highest that
can exactly be represented is 10 raised to the 27th power.

Regards, JohnH
.



Relevant Pages

  • Re: Fastcode RoundTo replacement
    ... The original RoundTo() that came with D6 or D7 has problems. ... Same are noted in still open QualityCentral report #8070. ... was probably meant to be type TRoundToRange = -27..27; ... The highest that can exactly be represented is 10 raised to the 27th power. ...
    (borland.public.delphi.language.basm)
  • Re: What is RoundToEx?
    ... Description Call RoundTo to round AValue to a specified power of ten. ...
    (borland.public.delphi.language.basm)
  • Re: Round currency
    ... which readers of this group may not see. ... It has been remarked that the RoundTo function does not reproduce the ... in it the allowances for the sign of ADigit, and the multiplication loop ...
    (comp.lang.pascal.delphi.misc)