Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Decimal not rounding up

npsmith
8 - Asteroid

Hello,

 

Can someone explain why Alteryx will round 1.25 to 1.3 but will round 1.025 as 1.02 instead of 1.03?

 

I have a text input with field "amt" = 1.025.

Select tool sets type as fixed decimal 19.3

formula tool creates field amt_rnd using " round(amt,.01) "

Result is 1.02 instead of 1.03.

 

Sample attached.

 

Thanks!

2 REPLIES 2
PeterP
8 - Asteroid

Hey @npsmith,

 

The below OP actually runs into the same exact issue that you are and KevinP does a great job of explaining why you are getting the unexpected behavior: 

 

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Alteryx-Odd-Behavior/td-p/89086

 

It primarily has to do with how computers store and perform math operations on floating point numbers. Therefore the rounding isn't inconsistent and is not necessarily incorrect. Hope this clears things up!

 

 

npsmith
8 - Asteroid

Thank you !!!! That was my theory based on similar issues in other previous applications but I couldn't find that article in my search attempts.

 

Thanks!!!!

Labels