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. The reason for this miscalculation seems to be, that the Formula-Tool can not handle numbers, that are as large as the first one. Does anyone have an idea how to work around that?
Thanks a lot in advance!
correction - you asked this question 3 months ago - and @Qiu made you a macro... as I said at the time -mod is an integer function and your number is larger than Int64. it will not work with mod on Alteryx... or excel.. there might be a python/r way.
@apathetichell
Wow, I did not recall until you brought it up. Thanks a lot.
@FlorianH
Here is my reply.
I can anwser some queries from you after your review of the flow.
FYI here's the R way...
dat <- read.Alteryx("#1", mode="data.frame")
install.packages("VeryLargeIntegers", repos='http //cran.us.r-project.org')
library(VeryLargeIntegers)
VLIMOD <- data.frame(c("value"))
for (i in 1:nrow(dat)) {
x <- as.vli(as.character(dat$VLI[i]))
VLIMOD[i] <- as.numeric(summod(x,0,dat$Divisor[i])$value)}
write.Alteryx(VLIMOD,1)
this assumes:
1) you don't have VeryLargeIntegers already installed and you can install packages in your R Tool
2) you MUST name your columns VLI (for the big number) and Divisor for the number you are dividing by.
3) you'll have to transpose the output because everything is in one row.
Hi @Qiu
thanks a lot! Unfortunately I'm not at all familiar with macros in Alteryx. I will try to solve it with python now.
Thanks anyway.
Cheers
Florian
User | Count |
---|---|
19 | |
15 | |
13 | |
9 | |
8 |