Re: ESL - math.e - rounding

new topic     » goto parent     » topic index » view thread      » older message » newer message

Jason Gade wrote:
> 
> Pete Lomax wrote:
> > 
> > On Wed, 03 Aug 2005 14:53:22 +0200, Juergen Luethje <j.lue at gmx.de>
> > wrote:
> > 
> > >Both functions sometimes return different results, when the (n+1)th
> > >decimal place of x equals 5:
> > >     round_half_even()        -- rounds to nearest even value
> > >     round_half_up()          -- always rounds up  ( surprise! smile )
> > >
> > >What do you all think?
> > 
> > UK VAT law would allow either, or round_half_down.
> > 
> > Another function to consider is knock_on_round(), for example if you
> > have a column of 100 7.125's, then they should be 7.12, 7.13, 7.12...
> > so that the sum of the rounded amounts is 712.50, not 712.00.
> > 
> > A clear_knock_on_round function would be an absolute necessity, or a
> > get/set pair for maximum flexibility.
> > 
> > Pete
> > 
> > 
> What is it (knock_on_round) used for? I mean, if I have a hundred numbers with
> 3 significant
> digits then I would add them up *before* rounding them. You wouldn't want to
> lose precision
> before getting your final answer, would you?
> 

That may not be practical.

Say the total before (knock_on_round) is what you payed for x amount of units.
When you total the amount sold the next day by the cost of each individual 
unit (there would be some 7.12 and some 7.13 then the total cost of sales
 would be more accurate.

Don Cole,
SF

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu