Re: Fastcode RoundTo replacement



John Herbster wrote:
"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

Can I use RoundToEX_JOH with Double's too? .



Relevant Pages

  • Re: Fastcode RoundTo replacement
    ... stating the definition of what the RoundTo function ... 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)