diff options
| -rw-r--r-- | bc.library | 10 |
1 files changed, 9 insertions, 1 deletions
| @@ -5,7 +5,7 @@ | |||
| 5 | * The following functions are available (aliases in parentheses): | 5 | * The following functions are available (aliases in parentheses): |
| 6 | * General utility: max, min, sgn, abs, floor, ceiling | 6 | * General utility: max, min, sgn, abs, floor, ceiling |
| 7 | * Arithmetic: factorial(fact), binomial(binom, bin), gcd, lcm, totient(phi) | 7 | * Arithmetic: factorial(fact), binomial(binom, bin), gcd, lcm, totient(phi) |
| 8 | * Calculus: exp, log(ln), pow, sin, cos, tan, cosh, sinh, tanh | 8 | * Calculus: exp, log(ln), pow, root, sin, cos, tan, cosh, sinh, tanh |
| 9 | * atan, atan2, asin, acos, atanh, asinh, acosh | 9 | * atan, atan2, asin, acos, atanh, asinh, acosh |
| 10 | * Constants (as functions): e(), pi() | 10 | * Constants (as functions): e(), pi() |
| 11 | * | 11 | * |
| @@ -187,6 +187,14 @@ define pow(a, b) { | |||
| 187 | return a ^ b | 187 | return a ^ b |
| 188 | } | 188 | } |
| 189 | 189 | ||
| 190 | define root(a, b) { | ||
| 191 | auto res | ||
| 192 | scale += 5 | ||
| 193 | res = pow(b, 1/a) | ||
| 194 | scale -= 5 | ||
| 195 | return res / 1 | ||
| 196 | } | ||
| 197 | |||
| 190 | define trig(x, ii, in, id) { | 198 | define trig(x, ii, in, id) { |
| 191 | auto i, n, d, series | 199 | auto i, n, d, series |
| 192 | scale += 10 | 200 | scale += 10 |
