Open saraedum opened 1 year ago
Seems to come from the fact that ANRational
allows Integer
and Rational
as _value
attribute (in qqbar.py
)
sage: a = QQbar(1)
sage: a._descr._value
1
sage: type(a._descr._value)
<class 'sage.rings.integer.Integer'>
And this is not taken care of in the following call
sage: type(qq_generator(a._exact_value()))
<class 'sage.rings.integer.Integer'>
Maybe removing lines 3419-20 in sage/rings/qqbar.py
would do the job
sage: gen2_3(sqrt3)
a^2 - 2
"""
- if self._trivial:
- return elt._value
if isinstance(elt, ANRational):
return self._field(elt._value)
but the extra type checking might slow down everything, so it might be preferable to do
sage: gen2_3(sqrt3)
a^2 - 2
"""
- if self._trivial:
- return elt._value
- if isinstance(elt, ANRational):
+ if self._trivial or isinstance(elt, ANRational):
return self._field(elt._value)
Is there an existing issue for this?
Did you read the documentation and troubleshoot guide?
Environment
Steps To Reproduce
Expected Behavior
I expected the result to live in the Rational Field.
Actual Behavior
The result lives in the Integer Ring.
Additional Information
No response