conversion of string to complex number with sage_eval should be avoided
Closed this issue · 4 comments
edgarcosta commented
At the moment, a string is converted complex number with the aid of sage_eval, however, if the precision of the field is larger than the precision of the RealLiteral this leads to inconsistent results:
sage: R = ComplexField(57)
....: S = R._real_field()
....: S("-13.59658451496887") == R("-13.59658451496887").real()
True
sage: R("-13.59658451496887*I") == R("-13.59658451496887")*I
False
sage: R("-13.59658451496887*I") == R("0", "-13.59658451496887")
False
sage: R("0", "-13.59658451496887") == R("-13.59658451496887")*I
True
sage: R(-13.59658451496887*I) == R("-13.59658451496887*I")
True
sage: (-13.59658451496887*I).parent()
Complex Field with 54 bits of precision
In #29979, a doctest was marked not tested because of this, which should be reverted once the problem is solved.
Component: coercion
Issue created by migration from https://trac.sagemath.org/ticket/30977
mkoeppe commented
comment:1
Setting new milestone based on a cursory review of ticket status, priority, and last modification date.
mwageringel commented
Description changed:
---
+++
@@ -16,3 +16,5 @@
sage: (-13.59658451496887*I).parent()
Complex Field with 54 bits of precision
```
+
+In #29979, a doctest was marked not tested because of this, which should be reverted once the problem is solved.mwageringel commented
comment:5
I have added the comment from #32129 which was a duplicate of this ticket.