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.

MOD-formula gives unexpected result

FlorianH
7 - Meteor

Hi 🙂

 

in order to check IBANs, I want to calculate the modulo 97 of very large numbers. In my example the number is 700901001234567890131400. Two websites independently say, that the result of 700901001234567890131400 modulo 97 is 90 (e.g. https://www.entwicklertools.de/tools/mathematik-tools/modulo-rechner/). But when I calculate it with Alteryx the result is -79. What could be the reason for that? Is the first number to big for Alteryx to handle?

 

FlorianH_1-1617656109843.png

 

 

 

Thanks a lot in advance!

4 REPLIES 4
apathetichell
18 - Pollux

I have a hypothesis - Mod is traditionally an integer function and your number is too large for Int64 so it's producing weird results...

 

support for hypothesis:

https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/Modulo-mod-Function-Not-just-for-Ev...

 

specifically says "two integers"

 

when I do try to convert it to an integer I get:

Formula (2) test: 700901001234567940538368.000000 does not fit in the type Int64

 

perhaps you can run it in the python tool with fmod?

Qiu
20 - Arcturus
20 - Arcturus

@FlorianH 

The mod of large number appears to be a challenge for most of the coding tools, meaning can not be computed directly.

I prepared a simple macro by following the idea of this.

I need to improve it though since it will not work for small numbers due to the data type mismatch. 🤣

0406-FlorianH.PNG

ExcelMod.PNG

Qiu
20 - Arcturus
20 - Arcturus

@FlorianH 

The lower snapshot is trying to prove that Excel also fails to calculate the mod of large number.

FlorianH
7 - Meteor

Hi Qui,

 

thank you so much for the macro! And sorry for not coming back on this issue for so long time, but unfortunately I had some other priorities. 

Could you improve the macro?

And could you please explain in more detail what is happening in the macro?

 

Thanks so much!

 

Florian

Labels