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

Fix conversion from AA to RealField() #16163

Open
sagetrac-tmonteil mannequin opened this issue Apr 14, 2014 · 1 comment
Open

Fix conversion from AA to RealField() #16163

sagetrac-tmonteil mannequin opened this issue Apr 14, 2014 · 1 comment

Comments

@sagetrac-tmonteil
Copy link
Mannequin

sagetrac-tmonteil mannequin commented Apr 14, 2014

As discussed in #16120, the conversion from AA to RR is not accurate:

sage: UCF.<E> = UniversalCyclotomicField()
sage: e = AA(3/2*E(7) + E(7)^3 + E(7)^4 + 3/2*E(7)^6)
sage: RR(e).exact_rational() - e
1.328?e-17
sage: RR(e).nextbelow().exact_rational() - e
-6.0?e-19

The aim of this ticket is to fix this.

CC: @videlec

Component: numerical

Keywords: mpfr, RIF

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

@sagetrac-tmonteil sagetrac-tmonteil mannequin added this to the sage-6.2 milestone Apr 14, 2014
@sagetrac-tmonteil sagetrac-tmonteil mannequin self-assigned this Apr 14, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@sagetrac-vripoll sagetrac-vripoll mannequin changed the title Fix converion from AA to RealField() Fix conversion from AA to RealField() Mar 21, 2015
@videlec
Copy link
Contributor

videlec commented Apr 11, 2015

comment:5

Why should it be accurate? The documentation of the method real_number is

Given a ``RealField``, compute a good approximation to self in
that field. The approximation will be off by at most two
ulp's, except for numbers which are very close to 0, which
will have an absolute error at most
``2**(-(field.prec()-1))``. Also, the rounding mode of the
field is respected.

@mkoeppe mkoeppe removed this from the sage-6.4 milestone Dec 29, 2022
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