Re: Fastcode RoundTo
From: John Herbster (herb-sci1_AT_sbcglobal.net)
Date: 06/16/04
- Next message: Dennis: "Re: Fastcode RoundTo"
- Previous message: Dennis: "Re: Fastcode RoundTo"
- In reply to: Dennis: "Re: Fastcode RoundTo"
- Next in thread: Dennis: "Re: Fastcode RoundTo"
- Reply: Dennis: "Re: Fastcode RoundTo"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 16 Jun 2004 13:34:12 -0500
"Dennis" <marianndkc@home3.gvdnet.dk> wrote
> What will your RoundTo function round (1.245, -2) to?
To avoid conflict with Math.RoundTo, I would not make a
function with that name.
The rounding routines in RoundToXReplacement_3c would do
the following rounding based on the control parameter (drHalfEven
which is the same as "bankers" would be the default):
1.24 drHalfEven, {Round to nearest else to even digit. a.k.a Bankers}
1.25 drHalfOdd, {Round to nearest else to odd digit. }
1.25 drHalfPos, {Round to nearest else toward positive. }
1.24 drHalfNeg, {Round to nearest else toward negative. }
1.24 drHalfDown, {Round to nearest else toward zero. }
1.25 drHalfUp, {Round to nearest else away from zero. }
1.24 drRndNeg, {Round toward negative. a.k.a. Floor}
1.25 drRndPos, {Round toward positive. a.k.a. Ceil }
1.24 drRndDown, {Round toward zero. a.k.a. Trunc}
1.25 drRndUp); {Round away from zero.}
Where it is understood that 1.24 would actually be the closest
representable number to that value. The 1.25, of course, being 5/(2^2)
can be exactly represented.
Regards, JohnH
- Next message: Dennis: "Re: Fastcode RoundTo"
- Previous message: Dennis: "Re: Fastcode RoundTo"
- In reply to: Dennis: "Re: Fastcode RoundTo"
- Next in thread: Dennis: "Re: Fastcode RoundTo"
- Reply: Dennis: "Re: Fastcode RoundTo"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|