Thank You Vass,
I am still not able to get an accurate result above 20! even when
converting to a real. Here is the code with output. I am trying to be as
simple as possible, thanks.
config const value:uint = 10;
var result:uint;
proc factorial(x: uint) : uint
{
if x < 0 then
halt("need a positive number");
return if x == 0 then 1 else x * factorial(x-1);
}
result = factorial(value);
writeln("factorial ", value, "= ",result);
writef("%er ", result:real);
writeln();
using Chapel version 1.18.
output (incorrect):
./factchpl -svalue=21
factorial 21= 14197454024290336768
1.419745e+19
output (correct):
./factchpl -svalue=20
factorial 20= 2432902008176640000
2.432902e+18
Regards,
-Tyler
_______________________________________________
Chapel-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-developers