This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
I have looked through a few of the rounding questions on here and cant quite figure out the answer....
I have a value 163.575 and I want to round to 2 decimal places, simple I thought with the round function but it does not seem to round this up to 163.58 but instead rounds it down to 163.57. How can I get 163.5755 to round up to 163.58? I have the precision set before going into the round function to 3 decimal places so it's not like Alteryx has the figure as 163.574999999 and is displaying it as 163.575 onscreen (or is it and im missing something?)
I've seen this before in this post. It has to do with the floating point representation of .575. It can't be exactly stored. If you convert it fixed format 25:20 you get
I know that you said that you specified a fixed decimal with 3 digits, but if you check this post, specifically the reply from AdamR from Alteryx
you find that all numeric values get converted to doubles on entry to the formula tool, so Fixed Decimal get converted to a double and falls afoul of the inexact representation problem.
The only way that I've found to consistently be able to round values that end in ...5 is to add a small amount to each number before rounding. The small amount should be several orders of magnitude smaller than what you round to, but several orders larger than the internal representation.
BTW: @Dario2k19 your solution rounds to multiples of .02. It works for .575 giving .58, but then .585 rounds to .58 as well as opposed to .59