Re: RoundEx without Banker's rounding



Dennis wrote:
I think that it is a challenge we could make soon.

I am thinking about something like...

function RoundEx(x: Extended; DecimalRoundingCtrl: TDecimalRoundingCtrl): Int64;

tDecimalRoundingCtrl = {Defined rounding methods} {From DecimalRounding_JH0}
   (drNone,     {No rounding.}
    drHalfEven, {Round to nearest else to even digit. a.k.a Bankers}
    drHalfOdd,  {Round to nearest else to odd digit. }
    drHalfPos,  {Round to nearest else toward positive. }
    drHalfNeg,  {Round to nearest else toward negative. }
    drHalfDown, {Round to nearest else toward zero. }
    drHalfUp,   {Round to nearest else away from zero. }
    drRndNeg,   {Round toward negative.               a.k.a. Floor}
    drRndPos,   {Round toward positive.               a.k.a. Ceil }
    drRndDown,  {Round toward zero.                   a.k.a. Trunc}
    drRndUp);   {Round away from zero.}

.



Relevant Pages

  • Re: Fastcode RoundTo
    ... The rounding control could be like the following: ... {Round to nearest else to even digit. ... drHalfOdd, {Round to nearest else to odd digit. ...
    (borland.public.delphi.language.basm)
  • Re: Fastcode RoundTo
    ... The rounding routines in RoundToXReplacement_3c would do ... {Round to nearest else to even digit. ... drHalfOdd, {Round to nearest else to odd digit. ...
    (borland.public.delphi.language.basm)
  • Re: Win32Forth & negative zero
    ... >>>Round to nearest/even is not necessarily better than others. ... nearest with even tie breakers "IEEE rounding", ... has four rounding modes, labeled in C99 as FE_TONEAREST, ... In particular C99, which I think is getting it right, and ought ...
    (comp.lang.forth)
  • RE: Rounding to nearest .00 or .50
    ... Then set your textbox control source and/or calculated query field to the ... > a course by dividing the total number of minutes of course instruction by 60 ... > but I need it to round to the nearest .00 which, ...
    (microsoft.public.access.forms)
  • Re: Hillary Clinton Gives Driving Advice
    ... would have to do would be to round to the nearest $0.1 instead. ... The gov't has tried that on the one with issuing the dollar coin (the ... "When you can't afford the gas to drive to the job ...
    (rec.autos.driving)