Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sage_input is unreliable for elements of ComplexField #32129

Closed
mwageringel opened this issue Jul 4, 2021 · 4 comments
Closed

sage_input is unreliable for elements of ComplexField #32129

mwageringel opened this issue Jul 4, 2021 · 4 comments

Comments

@mwageringel
Copy link

sage: fld = ComplexField(200)
sage: a = fld('0.85425665148473689034386458431097348561089439860408577398333', '20')
sage: sage_input(a, verify=True)
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
...
AssertionError: Expected 0.85425665148473689034386458431097348561089439860408577398333 + 20.000000000000000000000000000000000000000000000000000000000*I == 0.85425665148473689034386458431097348561089439860408577398333 + 20.000000000000000000000000000000000000000000000000000000000*I

Apparently, the last bits that are usually not printed get lost.

sage: b = sage_eval(sage_input(a, verify=False))
sage: a == b  # should be True
False
sage: a.str(truncate=False)
0.85425665148473689034386458431097348561089439860408577398333000 + 20.000000000000000000000000000000000000000000000000000000000000*I
sage: b.str(truncate=False)
0.85425665148473689034386458431097348561089439860408577398333374 + 20.000000000000000000000000000000000000000000000000000000000000*I

This was found by

sage -t --long --random-seed=3159 src/sage/rings/complex_mpfr.pyx

The corresponding real version works:

sage: sage_input(a.real(), verify=True)
# Verified
RealField(200)(0.85425665148473689034386458431097348561089439860408577398333)

In #29979, a doctest was marked not tested because of this.

Component: numerical

Reviewer: Markus Wageringel

Issue created by migration from https://trac.sagemath.org/ticket/32129

@mwageringel mwageringel added this to the sage-9.4 milestone Jul 4, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.4, sage-9.5 Jul 19, 2021
@mwageringel

This comment has been minimized.

@mkoeppe mkoeppe modified the milestones: sage-9.5, sage-9.6 Dec 18, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.6, sage-9.7 May 3, 2022
@mkoeppe
Copy link
Contributor

mkoeppe commented May 4, 2022

comment:5

dup of #30977?

@mwageringel
Copy link
Author

Reviewer: Markus Wageringel

@mwageringel
Copy link
Author

comment:6

Yes, it looks like it. Let us merge them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants