Opened 16 years ago

Closed 16 years ago

#8 closed enhancement (fixed)

Integer and Rational classes need nth_root and exact_power functions

Reported by: David Harvey Owned by: somebody
Priority: major Milestone:
Component: basic arithmetic Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

It would be useful for Integer and Rational classes to have:

(1) nth_root: this would wrap GMP's mpz_root. (2) exact_power: would accept a *rational* number as an index, and work out which root to take. For example

(-8/27).exact_power(2/3) == 4/9

I had to take an exact 6th root of a rational in some code the other day and it was painful going via real numbers, worrying about bits of precision and all that.

Change History (1)

comment:1 Changed 16 years ago by David Harvey

Resolution: fixed
Status: newclosed

Fixed.

Fri Sep 15 17:19:10 PDT 2006 dmharvey@…

  • Rational.nth_root() -- adds Rational nth root method

Fri Sep 15 17:18:20 PDT 2006 dmharvey@…

  • Integer.nth_root() -- adds nth root method to Integer (wraps GMP mpz_root)
Note: See TracTickets for help on using tickets.