blob: 6bc58b1c23cd763eac5443a1d0370a791a77b2d9 (
plain) (
tree)
|
|
define abs(x) {
if (x < 0)
x *= -1
return x
}
define fact(x) {
auto r
if (x < 0) {
print "Error: Negative factorial\n"
return 0
}
if (x % 1 != 0) {
print "Error: Non-integer factorial\n"
return 0
}
r = 1
for (i = 2; i <= x; i++)
r *= i
return r
}
|