sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.42k stars 478 forks source link

Continued fraction -> RR wrong for rationals -1/2^n with RNDD/RNDU rounding #19466

Closed jdemeyer closed 9 years ago

jdemeyer commented 9 years ago

All these should return the same value:

sage: RealField(53, rnd="RNDD")(continued_fraction(-1/2))
-0.500000000000001
sage: RealField(53, rnd="RNDU")(continued_fraction(-1/2))
-0.499999999999999
sage: RealField(53, rnd="RNDN")(continued_fraction(-1/2))
-0.500000000000000

Component: basic arithmetic

Author: Jeroen Demeyer

Branch/Commit: 55bf4e4

Reviewer: Vincent Delecroix

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

jdemeyer commented 9 years ago

Branch: u/jdemeyer/ticket/19466

jdemeyer commented 9 years ago

Commit: 55bf4e4

jdemeyer commented 9 years ago

New commits:

55bf4e4Fix continued fractions -> RR for negative numbers
videlec commented 9 years ago

Reviewer: Vincent Delecroix

videlec commented 9 years ago
comment:3

Nice: bug fix + simpler code!

vbraun commented 9 years ago

Changed branch from u/jdemeyer/ticket/19466 to 55bf4e4