From: Gary Wright Date: 2012-01-30T10:03:04+09:00 Subject: Re: Microrant on Ruy's Math Skills On Jan 29, 2012, at 2:26 AM, Jon Lambert wrote: > On Jan 27, 2012, at 3:26 PM, Gary Wright wrote: >> What 'value' do you expect for this expression: >> >> BigDecimal("1.0") / BigDecimal("3.0") > > Decimal math operations need use a default rounding context or require one to set a > rounding context before performing an operation. > > Do you round towards +infinity, -infinity, > towards 0, away from 0, > to nearest (and if equidistant, round down), > to nearest (and if equidistant, round up), or > to nearest (and if equidistant, round so that the last digit is even) aka. bankers rounding? > > Only then can you know what to expect. Agree 100%. I was just trying to illustrate that even if you have some wonderfully crafted big decimal literal syntax, you still need to address the context issues you just listed. 1.0D / 3.0D Might be easier to type but it is only part (perhaps a small part) of the puzzle. Gary Wright