James Wanless on Wed, 14 Mar 2012 10:18:08 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: sqrtint for rationals


Speaking of which, I _think_ I might have a solution for the Table- maker's dilemma: Specifically, if one has available integers of any length already ie thru' GMP, then why can't one just use _perfectly correct_ rationals (described as two integers, top and bottom of a fraction) [a little bit akin to two-coordinate complex numbers]. I don't see why then one couldn't carry through rationals w/ perfect accuracy thru all operations... or is this already what is used in MPFR etc.???
J

On 14 Mar 2012, at 09:03, Andreas Enge wrote:

Would it be easy to extend sqrtint to rationals? I need it in my code and think I could implement it as floor (sqrt ()); but whether this succeeds
depends on the floating point precision.

Andreas