### Re: Re: Re: Rounding errors problem

by merlyn (Sage)
 on Sep 28, 2001 at 18:19 UTC ( #115396=note: print w/replies, xml ) Need Help??

in reply to Re: Re: Rounding errors problem

The exchange rates are fixed and are offical Euro exchange rates. The invoice total, before conversion, equals the sum of the line items. After conversion they differ by a penny or so. I need to be sufficiently precise so that they are equal after conversion.
Maybe you don't get that this is not always possible. For example, consider a series of transactions of 103, 103, and 104 units. Those added together make 310 units. Now convert those into a currency that is 1/10 the size. We round 10.3 to 10 (twice) and 10.4 to 10 (once). The "total" should be 31, but it's really only 30. This is the way this works. You cannot always balance to the penny when you map values from one currency to another and it's considered fair accounting practice to simply note that and move on.

A parallel example: my brother noted that at a particular Washington State sales tax rate, it was cheaper by a penny to buy two single Big Gulps rung up separately than it was to buy them as a combined transaction. So whenever he had to buy two, he'd always buy one, pay, then buy the second one.

This is the real world, and it's accepted practice. Don't attempt the impossible. {grin}

Replies are listed 'Best First'.
Re:x4 Rounding errors problem
by grinder (Bishop) on Sep 28, 2001 at 18:35 UTC
You cannot always balance to the penny when you map values from one currency to another and it's considered fair accounting practice to simply note that and move on.

But note that noting that usually implies that the lost round-off amount is accounted for in a special "accumulate round-offs" account in the general ledger. I know we have such a beast at work. Otherwise (I hypothesise) you open yourself up to salami attacks.

--
##### g r i n d e r
Re: Re: Re: Re: Rounding errors problem
by perlcgi (Hermit) on Sep 28, 2001 at 19:37 UTC
D'oh! Its impossible! Perlcgi has an epiphany. That's the key insight! Thank you very much Randal. {grins back in humble appreciation}

Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://115396]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2023-02-01 09:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?

No recent polls found

Notices?