• (cs) in reply to Sick Burn
    Sick Burn:
    hoodaticus:
    Sid Burn:
    Storing Money as an INT is the only correct way. DECIMAL does not work like shifting an INT how somebody tells before. It primary works with a lot of rounding. That's the reason why you should never use a decimal for money.
    For the noobs - this guy is trolling or doesn't know wtf he's talking about, or both.
    Was it something he said? Or just that he's posting on this board?
    Probably the former, but the latter is more than sufficient reason for doubt. (Are you new here?)
  • smf (unregistered) in reply to Sick Burn
    Sick Burn:
    hoodaticus:
    Sid Burn:
    Storing Money as an INT is the only correct way. DECIMAL does not work like shifting an INT how somebody tells before. It primary works with a lot of rounding. That's the reason why you should never use a decimal for money.
    For the noobs - this guy is trolling or doesn't know wtf he's talking about, or both.
    Was it something he said? Or just that he's posting on this board?

    What he said was wrong.

    You can't get rounding errors with decimal types. Essentially they are exactly the same as storing tenths, hundredths etc but the field in the database knows how many decimal places it has. So you don't have to multiply/divide in your own code and you can add extra decimal places and you don't need to convert the data.

    Floating point numbers do suffer from rounding errors and shouldn't ever be used if you need accurate results

  • Happy Birthday Nathan! (unregistered)

    Happy Birthday Nathan!

    :)

  • The Ancient Programmer (unregistered) in reply to boog

    A thousand year old Chinese guy?

  • Sick Burn (unregistered) in reply to The Ancient Programmer
    The Ancient Programmer:
    A thousand year old Chinese guy?

    He probably still uses waterfall.

  • Real Engineer, not Software Engineer (unregistered) in reply to Sick Burn
    Sick Burn:
    The Ancient Programmer:
    A thousand year old Chinese guy?

    He probably still uses waterfall.

    Everyone that knows what they're doing uses waterfall--not everyone that uses waterfall knows what they're doing. When Computer Science matures to a point where it earns its title ("Science"), everything will be "waterfall."

  • Hortical (unregistered) in reply to Real Engineer, not Software Engineer
    Real Engineer:
    Sick Burn:
    The Ancient Programmer:
    A thousand year old Chinese guy?

    He probably still uses waterfall.

    Everyone that knows what they're doing uses waterfall--not everyone that uses waterfall knows what they're doing. When Computer Science matures to a point where it earns its title ("Science"), everything will be "waterfall."
    You seem to be confused about which phases in software dev should actually be considered "implementation" and "design". Give it some thought, champ.

  • (cs) in reply to Hortical
    Hortical:
    Real Engineer:
    Sick Burn:
    The Ancient Programmer:
    A thousand year old Chinese guy?

    He probably still uses waterfall.

    Everyone that knows what they're doing uses waterfall--not everyone that uses waterfall knows what they're doing. When Computer Science matures to a point where it earns its title ("Science"), everything will be "waterfall."
    You seem to be confused about which phases in software dev should actually be considered "implementation" and "design". Give it some thought, champ.
    Indeed. Real Engineer must dream of a utopian future in which users have their requirements fully and infallibly spec'd down to the last detail before your first design meeting.

  • QJo (unregistered) in reply to hoodaticus
    hoodaticus:
    Hortical:
    Real Engineer:
    Sick Burn:
    The Ancient Programmer:
    A thousand year old Chinese guy?

    He probably still uses waterfall.

    Everyone that knows what they're doing uses waterfall--not everyone that uses waterfall knows what they're doing. When Computer Science matures to a point where it earns its title ("Science"), everything will be "waterfall."
    You seem to be confused about which phases in software dev should actually be considered "implementation" and "design". Give it some thought, champ.
    Indeed. Real Engineer must dream of a utopian future in which users have their requirements fully and infallibly spec'd down to the last detail before your first design meeting.
    No, he's probably just sitting in a wheelchair with a tartan blanket keeping his knees warm while his nice nursie gives him a lovely weak cup of tea and a biscuit.

  • Board at Work (unregistered)

    Sigh, can we please stop this trend of waiting until late afternoon to post an article?

  • eVil (unregistered) in reply to Board at Work
    Board at Work:
    Sigh, can we please stop this trend of waiting until late afternoon to post an article?

    Yes... please make sure that new articles are posted by 09:00 GMT each weekday!

  • The Corrector (unregistered) in reply to eVil
    eVil:
    Board at Work:
    Sigh, can we please stop this eVil trend of waiting until late afternoon to post an article?

    Yes... please make sure that new articles are posted by 09:00 GMT each weekday!

    FTFY

  • The Economist (unregistered) in reply to The Corrector
    The Corrector:
    eVil:
    Board at Work:
    Sigh, can we please stop this eVil trend of waiting until late afternoon to post an article?

    Yes... please make sure that new articles are posted by 09:00 GMT each weekday!

    FTFY
    What are you complaining about? Alex is simply trying to drive traffic away from his website so that he can irritate his sponsors.

  • (cs) in reply to The Corrector
    The Corrector:
    eVil:
    Board at Work:
    Sigh, can we please stop this eVil trend of waiting until late afternoon to post an article?

    Yes... please make sure that new articles are posted by 09:00 GMT each weekday!

    FTFY

    FTFTFYFY, and now we've come full circle.

  • KA0F1 (unregistered)

    when it comes to futures trading and financial flim-flam, it's better to just let the code be a failure.

    It's a laudable goal to work towards putting food on the table, but not when it's a contribution to economic destruction. The person writing the code has more at stake and more to lose than the benefactors of such a BS leaky financial suction pump.

  • (cs) in reply to KA0F1
    KA0F1:
    when it comes to futures trading and financial flim-flam, it's better to just let the code be a failure.

    It's a laudable goal to work towards putting food on the table, but not when it's a contribution to economic destruction. The person writing the code has more at stake and more to lose than the benefactors of such a BS leaky financial suction pump.

    ^This. Suddenly the introduction

    Pete, a clever coder,
    makes more sense!
  • Lewton (unregistered) in reply to MeesterTurner
    MeesterTurner:
    A long-standing part of our core app stores how long someone has been living at an address.

    The sensible solution would be to store it in an integer for months, so if you wanted 1 year 6 months, you store 18. Nice and easy to work with.

    But no. Before I began working on it, someone had the bright idea of using decimals, so 18 months is then stored as 1.6... which is ok for the first 9 months, and then you get to, sa, 1yr 10mths which is 1.10 - which is the same is 1yr 1mth...

    Cue constant frustration, and due to the amount of work to do a best-guess-conversion and store it in months and use that field across all of the related apps, management lives with it to this day... 10 years later!!!!

    That is... Amazing

  • (cs) in reply to Schol-R-LEA
    Schol-R-LEA:
    Gunslinger:
    So, TRWTF is management. Or money.
    You're absolutely right. You should give me all of your money so I can dispose of it properly.
    Your comment shows you are a communist. Please proceed to the nearest slaughterhouse.

    Long life to the Computer.

  • Luiz Felipe (unregistered) in reply to Dave
    Dave:
    boog:
    Cue a bunch of angry complaints about Andy's DECIMAL solution, not to mention a solid day's worth of comments bitching and arguing about how to store money in databases.

    I've seen worse done with financial amounts. For example ASN.1 stores financial values as ASN.1 INTEGERs, which go up to 3*10^186. Some standards authors decided that this wasn't enough and broke it down into two values, a base and an exponent, because apparently the range of an INTEGER, although sufficient to enumerate the number of subatomic particles in the universe, wasn't sufficient for moderate-sized financial transactions.

    Man, have you ever seen some inflation in africa. Lucky they dont have money to use information systems. They burn money to heat because its cheaper to use money cedules instead of wood.

  • Oslo (unregistered) in reply to dohpaz42
    dohpaz42:
    The Corrector:
    eVil:
    Board at Work:
    Sigh, can we please stop this eVil trend of waiting until late afternoon to post an article?

    Yes... please make sure that new articles are posted by 09:00 GMT each weekday!

    FTFY

    FTFTFY, and now we've come full circle.

    FTFY

  • JolleSax (unregistered) in reply to Son Of Thor
    Son Of Thor:
    realy storing money as an int is not a WTF but almost standard practics in the banking world. and storing 1/10 of a cent is not unusual.
    Don't know if that makes the code any less WTF. It does explain a whole lot about economy though....
  • Jacob Roden (unregistered) in reply to JolleSax

    Its true, the real WTF is that people think it is always correct to store money in decimal format. It IS VERY common that storing in integer format is best. It is associated with how banks and accountants reconcile accounts.

    ie $1 divided by three in the real world is $0.33c $1 divided by three when stored as an integer works too, ie 100c/3=33c $1 divided by three in decimal is $0.3333...

    These summ the errors over time and your software using decimal maths will be declared broken by any competent accountant!!!

  • Pete (unregistered)

    What? DECIMAL is a completely useless datatype! Everyone knows that non-integer numbers cannot be stored precisely by computers; you get... err... fuzzy bits!

  • Jacob Roden (unregistered) in reply to Pete
    Pete:
    What? DECIMAL is a completely useless datatype! Everyone knows that non-integer numbers cannot be stored precisely by computers; you get... err... fuzzy bits!

    Decimal has good uses, just not for money. It sounds like a good idea until you work out that you cant do money math with decimal

  • Axel (unregistered)

    There's an answer for management who won't allow a rewrite where one is clearly needed: go on strike. Tell them: "You know what? No. I'm not gonna port this code, because once I do, it's gonna have my name on it. And I refuse to put my name on what I know is a buggy piece of shit. You want it ported? You port it. Then you can put your name on it."

    It works best when there are multiple team members who feel the same way. Same speach, just with plural possessives. I find the "won't-compromise-my-reputation" speech gets better results than dispassionate logic. Show that you really CARE, and win the day.

    But bring your resume up-to-date first, just in case.

Leave a comment on “Classic WTF: Price In Nonsense”

Log In or post as a guest

Replying to comment #:

« Return to Article