Beefy Boxes and Bandwidth Generously Provided by pair Networks
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?

Replies are listed 'Best First'.
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?
[marioroy]: Morning Discipulus. porting C code to Perl is an interesting problem for running parallel. I will try and the reason for attempting Perl code to match C 100%.
marto waves
[Discipulus]: hello marioroy! yes i need to start to write parallel, but not with this Pi code; it is yet melting my brain on it's own!

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2017-10-24 07:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (286 votes). Check out past polls.

    Notices?