Alteryx Designer Desktop Discussions

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

Decimal number with large scale automatically rounded by Double

Brayndasilva
7 - Meteor

Hi,

 

I am working with decimal values that can range up to a scale of 13 - for example: 51.9999999999999.

 

This value is given as input for a condition where if X >= 52 then true. In this exceptional case it should return false, but the data type Double automatically rounds this value as '52' giving it an outcome of true. This is caused due to the scale beyond 6 which the Double rounds up to for clarity.

 

When the data type is changed to FixedDecimal with a precision of 19 and scale of 13, the value passes as it should and is given an outcome of false. As desired. However, I would like this value to be of two decimals but without the rounding. Ideally just cutting off the remaining decimals at a certain point.

 

What is the most efficient way to process '51.9999999999999' to '51.99' as a Double?

6 REPLIES 6
atcodedog05
22 - Nova
22 - Nova

Hi @Brayndasilva 

 

Here is one way of doing it.

 

Workflow:

atcodedog05_0-1643800056074.png

 

Hope this helps : )

 

saveeshkumar
9 - Comet

Hi @Brayndasilva ,

 

Please find the formula below.

 

FLOOR(ABS(ToNumber([Value])*100)+.000000000001)/100

 

saveeshkumar_0-1643801953217.png

 

Thanks.

 

 

 

 

saveeshkumar
9 - Comet

Hi @Brayndasilva ,

 

Update the datatype from String to FixedDecimal.

 

saveeshkumar_1-1643802492565.png

 

atcodedog05
22 - Nova
22 - Nova

Interesting methods @saveeshkumar 🙂👍

atcodedog05
22 - Nova
22 - Nova

Hi @Brayndasilva 

 

My take on one more method

 

atcodedog05_0-1643802908828.png

 

Hope this helps : )

 

atcodedog05
22 - Nova
22 - Nova

Happy to help : ) @Brayndasilva 

Cheers and have a nice day!

Labels