Slashdot Mirror


Rounding Algorithms

dtmos writes "Clive Maxfield has an interesting article up on PL DesignLine cataloging most (all?) of the known rounding algorithms used in computer math. As he states, "...the mind soon boggles at the variety and intricacies of the rounding algorithms that may be used for different applications ... round-up, round-down, round-toward-nearest, arithmetic rounding, round-half-up, round-half-down, round-half-even, round-half-odd, round-toward-zero, round-away-from-zero, round-ceiling, round-floor, truncation (chopping), round-alternate, and round-random (stochastic rounding), to name but a few." It's a good read, especially if you *think* you know what your programs are doing."

17 of 279 comments (clear)

  1. Round this! by Anonymous Coward · · Score: 5, Funny

    1.44th post!

    1. Re:Round this! by baadger · · Score: 2, Funny

      shouldn't that be '1.44st post'...the mind is torn between math and grammar.

    2. Re:Round this! by TooFarGone · · Score: 2, Funny

      When rounding, I always look to this simple pattern:
      You spin me right round, baby Right round like a record, baby Right round round round

      It doesn't help my rounding, but it's sure is fun =)

  2. Most important... by T-Ranger · · Score: 5, Funny

    Round down and put the extra aside. Say, in your own account. Like the have-a-penny-need-a-penny jar at the local Gulp-n-Blow.

    1. Re:Most important... by ClamIAm · · Score: 1, Funny
      Gulp-n-Blow.

      There has to be a joke here, I know there does.

  3. my favorite rounding algorithm by User+956 · · Score: 4, Funny

    my favorite rounding algorithm is pi(r)^2.

    --
    The theory of relativity doesn't work right in Arkansas.
  4. My personal rounding program by charlesbakerharris · · Score: 5, Funny
    For rounding, I use the following:
    • Mountain Dew
    • Couch
    • Lack of willpower
    • Utter disdain for annual resolutions I made less than a week ago
    • DiGiorno's pizzas.
    Seems to work.
    1. Re:My personal rounding program by Spy+der+Mann · · Score: 3, Funny

      * DiGiorno's pizzas.

      Seems to work.


      So that's rounding towards positive infinity, right? :P

  5. Re:offtopic by jeblucas · · Score: 1, Funny

    I think you mean:
    Round-up, Round-down, get around-toward-nearest,
    I get around-half-up,
    Yeah,
    Get around-half-down, round-half-even, round-half-odd, I get around-toward-zerowooooooHHHHooo!

    --
    blarg.
  6. Ugh by zzen · · Score: 3, Funny

    I don't think I know what my programs are doing all the time...
    I just hope they play nice when I'm not watching. :)

  7. Re:Think you know.... by Rosco+P.+Coltrane · · Score: 5, Funny

    Why would my wife being pregnant be a problem?

    You'll know 13 years from now :)

    --
    "A door is what a dog is perpetually on the wrong side of" - Ogden Nash
  8. Office Space by TubeSteak · · Score: 5, Funny
    PETER
    So when the subroutine compounds the interest, right, it uses all these extra decimals places that just get rounded off. So we just simplify the whole thing and we just round it down and drop the remainder into an account that we own.

    JOANNA
    So you're stealing.

    PETER
    Ah, no. No. You don't understand. It's, uh, very complicated. It's, uh, it's, it's aggregate so I'm talking about fractions of a cent that, uh, over time, they add up to a lot.
    --
    [Fuck Beta]
    o0t!
  9. Social Applications by Kesch · · Score: 5, Funny

    So it turns out instead of 2, there are more like 9 different types of people.

    The classics:
    Those who round a glass of water up (Has been filled)
    Those who round it down (Has been emptied)

    The oddballs:
    The round-half-up crowd(Half or greater is filled)
    The round-half-down crowd(Half or less is empty)
    The round toward zero types(Always empty)
    The round away from zero groupies(Always Full)
    The round alternate weirdos(They get interesting when you give them two glasses)
    The round random subset(Carry around a coin or die to decide such problems)
    And finally...
    The truncate ones who cannot handle such a problem and smash the glass to make sure it is empty.

    --
    If this signature is witty enough, maybe somebody will like me.
  10. Re:RIAA Rounding by Anonymous Coward · · Score: 1, Funny
    RIAA method:
    if (sales(type_cd,2005) < sales(type_cd,2004)) {
    set_sales(type_cd,2005)=0;
    blame_pirates();
    }


    Really? I thought it was more like:
    if (sales(type_cd,2005) <= sales(type_cd,2004)) {
      set_sales(type_cd,2005,0);
    }
    else {
      set_projected_sales(type_cd,2005,sales(type_cd,200 5)*2);
    }
    blame_pirates();
  11. Re:Seems dumb to me by Tim+Browse · · Score: 2, Funny

    And thus began the slide of Vegas casinos into insolvency.

  12. Rounding? by students · · Score: 2, Funny

    Rounding? Real men use a confidence interval anyway, so rounding is irrelevant.

  13. Re:Think you know.... by v01d · · Score: 2, Funny

    If you can't carry out your 13 year old, either they need a diet or you need more excercise.