lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On 21 Sep 2006, at 23:40, Doug Currie wrote:

Thursday, September 21, 2006, 6:01:12 PM, David Jones wrote:

Funny how no-one ever wants round-away-from 0, could be called
"inflate" perhaps?

I just happen to be working on my decNumber documentation...

decNumber.ROUND_CEILING     round towards +infinity
decNumber.ROUND_UP          round away from 0
decNumber.ROUND_HALF_UP     0.5 rounds up
decNumber.ROUND_HALF_EVEN   0.5 rounds to nearest even
decNumber.ROUND_HALF_DOWN   0.5 rounds down
decNumber.ROUND_DOWN        round towards 0 (truncate)
decNumber.ROUND_FLOOR       round towards -infinity

That's not your decNumber documentation, it's Java's java.math.BigDecimal documentation. :)

I can't believe they (whoever created java.math.BigDecimal) called "truncate" "Round Down". I would naively expect Round Down to be the same as floor. I can't believe you copied them. Does your number line look like a V with 0 at the bottom centre?

It seems that ISO C 1999 (borrowed from IEC 60559) agree more with me. ISO C has FE_DOWNWARD and FE_TOWARDZERO and as far as I can tell they're different.