Hi
I tried to use fact() - factorial of a number and see that this function is limited to 21 max (from CT contrib - ctmath2.c).
But if you try fact(21), the result is:
51.090.942.171.709.430.000 harbour / xharbour - WRONG
51.090.942.171.709.400.000 EXCEL 2013! - WRONG
51.090.942.171.709.440.000 any calculator (the one in W10) - RIGHT
Anyway, as it is limited to 21, does anyone know a way to calculate factorial() without any limit or at least use a greater limit like 30 (without rounding issues)?
I know: the problem relies on the double precision math that harbour/C uses.
I tried myself with my own function (with a for-loop or recursively) and obviously I get the same wrong result.
If I try with greater numbers than 21 I get rounding problems (the proper upper limit should be 20 for the CT source file, if someone can fix it).
A must will be to have the gamma function, but this is a totally different story.
Regards
Claudio Voskian