roots of cubics?



> The polynomial is p(z) = -z^3 + 14*z + 12
> ...However,  realroots produces 3 rational roots.
> ...I was surprised that "realroots" produced rational solutions in the
> first place, but, given that, I thought I'd be in the realm of
> rational arithmetic.

I think you have misunderstood realroots.  Realroots finds a *rational
approximation* to the roots to any given precision.

I'm not sure why it gives its result as a rational number rather than
a bfloat: perhaps because it was written before bfloats existed;
perhaps because it is more efficient internally to do the calculation
with rationals rather than bfloats (because rationals naturally deal
with the different precision at each iteration); perhaps because the
algorithm it uses is inherently a rational-number rather than a
floating-number algorithm.  I suspect a combination of the three.

In any case, it is behaving as documented:

-- Function: realroots (<poly>, <bound>)
     Finds all of the real roots of the real univariate polynomial poly
     within a tolerance of bound which, if less than 1, causes all
     integral roots to be found exactly.  The parameter bound may be
     arbitrarily small in order to achieve any desired accuracy.  The
     first argument may also be an equation.  `realroots' sets
     `multiplicities', useful in case of multiple roots.  `realroots
     (<p>)' is equivalent to `realroots (<p>, rootsepsilon)'.
     `rootsepsilon' is a real number used to establish the confidence
     interval for the roots.  Do `example (realroots)' for an example.