[Solved] Factorial Math Function

Hi all,
I try to create a loop to calculate Factorial math function…
It works sometimes but the mathematical calculation can change and I don’t know why. May be it’s due to the type of the variable (numeric vs text) ?? Is it possible to change the text variable into a numeric variable to be sure that the calculation is good ?
Do you have another idea why the calculation can change ?
Thanks…

In the screen you can see the loop to calculate the factorial of the sum 1, 2, 3 and 4.
And the result…

The sum of the row 1 is 2 (Tot A = 1 + 1) and correct and the factorial gives 6
The sum of the row 2 is 4 (Tot B = 2 + 2) and correct but the factorial gives 360 !!!

If you want to ensure that a text variable is interpreted as a number, add 0 to it. That will convert the value to a scalar.

That said, with your loops, you keep multiplying a variable (‘ap’, ‘bp’, ‘cp’, etc) by a coefficient and assigning it back to itself. The question is: how do you ensure that “ap” does not have a pre-existing value? Do you start by initializing them to 1 before multiplying with anything?

Hi
Thanks for your answer.
Yes I have a Function before to run the loop Which initialize each variable to 1 :frowning:

Hi,

Get Factorial

3 Likes

Whaouhhhhh
Respect :flushed:
I will try this.

Hello,
May be I missed something… When I try to run your procedure, the result is one… Where is my mistake ?
TEFA is my Input field
label44 my label
ap is my variable (-> number)

Hello,

Instead of variables from function parameters, you use problem blocks of global variables.

I’m sorry, I don’t understand…
Need I use another variable ? AP is not the good one ?

%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5

I see the getfactor different… This module is not in the function one ?

:frowning:
Terrible… I will try…
Sorry

It’s ok now…
THANKS +++

@franckled, I’ve merged you 3 responses into a single post.

For future reference, if you have updates or amendments to make to a post in the community, please use the Edit button :pencil2: on your post.

ok

1 Like