Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Don't ask to ask, just ask
 
PerlMonks  

Re^2: At what level of structural complexity is Moose a win-win?

by Corion (Pope)
on Sep 29, 2010 at 15:22 UTC ( #862630=note: print w/ replies, xml ) Need Help??


in reply to Re: At what level of structural complexity is Moose a win-win?
in thread At what level of structural complexity is Moose a win-win?

Why would you want to store currency as two items, instead of storing it as an amount of cents alone?

What makes more sense in this context is to store a monetary amount as the currency it is in, together with the amount and potentially the place of the decimal point.


Comment on Re^2: At what level of structural complexity is Moose a win-win?
Re^3: At what level of structural complexity is Moose a win-win?
by chromatic (Archbishop) on Sep 29, 2010 at 16:12 UTC

    Sure, that's usually a better approach. I don't remember the details of why, but for one project it made sense to store dollars and cents separately. (Maybe it was because the retailer used the number of cents to indicate special information such as "manufacturer price" and "clearance price" and we didn't want to recalculate from decimal information every time.) Pre-breakfast, of course that was the first example to come to mind.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://862630]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2014-04-20 17:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (485 votes), past polls