Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re^2: Best way to round a number.

by Anonymous Monk
on Oct 25, 2012 at 00:37 UTC ( #1000741=note: print w/replies, xml ) Need Help??

in reply to Re: Best way to round a number.
in thread Best way to round a number.

Alright, forget the multiple of 5 thing, its to the nearest 5 per say; therefore 33, should go to 30 because of the logic on the sample code I gave here, if the last number in this case is 3 (from 33), is less than five it should go to 30. So number 11 should go down to 10, 17 should round up to 20, I hope I am a lil clear on that now, thanks!

Replies are listed 'Best First'.
Re^3: Best way to round a number.
by BrowserUk (Pope) on Oct 25, 2012 at 00:55 UTC
    I hope I am a lil clear on that now, thanks!

    Not really. Are you saying that

    1. if it is less that xx5, it rounds down.
    2. if it is greater than xx5 it rounds up.
    3. But if it is equal to xx5, it stays as is?

    If so, that is a very peculiar rounding mode?

    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    RIP Neil Armstrong

Re^3: Best way to round a number.
by ajam (Acolyte) on Oct 25, 2012 at 02:40 UTC

    How is 33 closer to 30 than to 35?

    30 31 32 33 34 35

    I count two numbers between 30 and 33, but only one number between 33 and 35. Clearly 33 is closer to 35.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1000741]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (8)
As of 2017-10-23 12:57 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (279 votes). Check out past polls.