Re: Rounding??



On Tue, Jun 12, 2001 at 09:38:02PM -0000, Morten Welinder wrote:

   Certainly but when you provide a mapping from one space (binary) to the
   display space (decimal) is important that the display understands its
   (numeric) context.  

Users expect it, but it is not possible.

An accountant will want "0.365" rounded to "0.36".  A mathematician

Doesn't this depend on the location of the accountant?  I guess I'm only
an (ex-)mathematician pretending to be an accountant at the moment. ;)


will want "0.37".  Someone is not going to like the result.  The
mathematician also wants "=sin(pi/4)-cos(pi/4)" to yield zero.  Don't
count on it.

True, but most computation-aware mathematicians understand epsilon
errors. We just make an assumption that e = whatever defines a region
where sin(pi/4)-cos(pi/4) being close enough to zero, is in fact zero.



Usual when you start saying the magic words "Someone is not going to
like the result", its time to start thinking about providing a menu
option.



Right now we are consistent in the best-approximation sense[*], I
hope.  And no-one is happy, because -- as you say -- people generally
do not think in binary.

See the 0.62 release notes in your NEWS file for more information.

You mean:


  Make rounding functions (ROUND, TRUNC, FLOOR, CEIL, ...) behave more
  like most users expect. The number 1.54999...9 will now be rounded to
  1.6, not 1.5. In other words, we are assuming that the number is really
  meant to be 1.55, but has suffered floating point effects. (If you ever
  truly get a number that is within DBL_EPSILON of a rounding threshold,
  well, then you lose. With a binary representation, we cannot all win.)


Things like that are always tricky.  Still 3/8 is nowhere near
1.54999...9...   

Then again maybe it is in the binary space.


I guess the main problem I have is when this occurs:

3, 3/8, A1 + A2 


Displays as at 2 dp

3, .38, 3.37


ie. it seems to say 3 + .38 = 3.37.  


Hmm.  Regardless of whether you are an accountant or mathematian that
'looks like' a interface/display bug to me. 

Of course from your comments I understand why it occurs now, doesn't
mean I like that behaviour.



Nicholas




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