Category talk:Wren-big: Difference between revisions

→‎Source code: Added BigRat.cbrt method.
(→‎Source code: Added a second divisors method.)
(→‎Source code: Added BigRat.cbrt method.)
Line 1,769:
// Convenience version of the above method which uses 14 decimal places.
sqrt { sqrt(14) }
 
// Returns the cube root of the current instance to 'digits' decimal places.
// Five more decimals is used to try to ensure accuracy though this is not guaranteed.
cbrt(digits) {
if (!((digits is Num) && digits.isInteger && digits >= 0)) {
Fiber.abort("Digits must be a non-negative integer.")
}
digits = digits + 5
var powd = BigInt.ten.pow(digits)
var cbtd = (powd.cube * _n / _d).icbrt
return BigRat.new(cbtd, powd)
}
 
// Convenience version of the above method which uses 14 decimal places.
cbrt { cbrt(14) }
 
// Other methods.
9,476

edits