factorial function Null safety
- double x
Implementation
double factorial(double x) {
if (x >= 70) {
return double.infinity;
} else if (x >= 0 && x == x.floorToDouble()) {
final lim = x.floor();
double result = 1;
for (int i = 1; i <= lim; i++) {
result *= i;
}
return result;
} else {
return laGamma(x + 1);
}
}