Hello,
I was wondering what exactly smartround function does? We can clearly see that some numbers are rounded up and some rounded down for no reason I can think of.
The explanation "SMARTROUND(x) - Return [x] rounded to nearest multiple of a value determined dynamically based on the size of [x]" doesn't mean much to me, any help would be appreciated. Would be nice to walk me through the process that rounds 6893.213 to 6900 and at the same time rounds 564.321 to 560.
Regards,
Solved! Go to Solution.
Hi @Fran2
1. There is no specific algorithm for Smartround.
2. It determines the value dynamically based on the size of the number
i.e 6893
or 689
or 68
Hence it rounds to the nearest multiple like 6900 even if it is 6896 as because the weightage of 6900 is huge than 68 or 64.
So we cant expect 68 or 64 to round up to 60.
Hope my explanation was useful to your learning...
I am sorry, not following you, nearest multiple of what? 4 is a multiple of 2. 6900 is not a multiple of 6896. In fact, none of the numbers in the "smartrounded" column are multiples of the numbers they are somehow rounded from.
Hi @Fran2
Nearest multiple of 100. for 4 digit numbers weightage.
For ex, 6851 will be rounded to 6900
6893 to 6900
6940 to 6900
6949 to 6900
6951 to 7000
Many thanks
Shanker V
After looking into this a bit more, this is actually an oversimplification of the smartround function. It's explained in more detail below.
@Fran2 It just adjusts its rounding to the magnitude of the number.
The normal 'round' function takes two arguments, the number to be rounded and another number that defines what it is rounded to.
So round(101.4,1) will round the number 101.4 to the nearest 1.
Smart round just chooses this second number based on the magnitude of the first.
If it is in the thousands, the second number will be 100. Hence 6896 is rounded to the nearest 100.
If it is in the hundreds, the second number will be 10. Hence 689 is rounded to 670.
Etc.
Ok, so basically rounds up to something that might make sense when you take into account how big the number is? Many thanks!
@Fran2 ,
Having played with the function a bit more just now, I've realised it isn't quite as simple as I first thought.
For example:
This seems counter-intuitive, as the round function is increasing the number of decimals.
I think in this case it is rounding to the nearest 0.125. This is 1/8, a commonly used multiple.
We can see similar here:
Although 1230 is more of a 'round number' than 1225, smartround still rounds it to the nearest 25.
As far as I can tell, smartround rounds to multiples of 2^0, 2^-1, 2^-2, 2^-3 etc. It changes its order of magnitude based on the number being rounded. Take the example above. It rounds 1230 to the nearest 25. 25 is equal to (2^-2)*100.
I still don't fully understand how it works, but it is definitely not as simple as my above reply would suggest.