Closed zimmermann6 closed 15 years ago
This is the "canonical coercion", which is a somewhat different concept than coercion (the terminology is bad, and may change).
Canonical coercions are the coercions that Sage applies automatically, for instance when doing arithmetic. If you try to add (or multiply, etc.) an element of A and an element of B, sage will look for a canonical coercion from A to B and a canonical coercion from B to A. (Only one of these should exist.) It will apply this coercion, and then do the arithmetic.
In general, the Sage policy is to prefer to throw away information, rather than make up information; so the product of an RR and an RQDF is an RR.
Explicit coercions are more general; for instance, both RR(RQDF(1)) and RQDF(RR(1)) work.
So the fact that the canonical coercions seem "backward" is by design. However, the use of 212 instead of 215 does seem to be a bug.
Even if one can represent 215 bit numbers exactly with RDQF, the arithmetic it seems is only done to 212 bits of precision according to the documentation, so this would seem to be the correct bound.
Should this be marked as invalid then?
Since we are removing RQDF, I'm going to mark this as invalid.
I do not understand the following in RQDF??:
On the contrary, RealField(p) should coerce to RQDF exactly for p <= 212 (in fact this should be 215 = 53 + 1 + 53 + 1 + 53 + 1 + 53 since if you round to nearest, then the remainder is smaller than 1/2 ulp of the most significant part).
Thus coercion from RealField() to RQDF should always work.
Component: basic arithmetic
Issue created by migration from https://trac.sagemath.org/ticket/1144