• Lynn Pettis (10/27/2016)


    Luis Cazares (10/27/2016)


    Here's an example of the different behavior of ROUND and CEILING/FLOOR.

    Luis, your expected return values for the negative values are wrong. Rounding negative values up doesn't go the direction you put the expected values. Rounding -30.1 up to the nearest 30 would go to -30 not -60 as -30 > -30.1. This is shown in your actual results.

    I would say that it depends. Rounding isn't fully defined and can follow different rules.

    That's why I left both options to compare.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2