Dear Pat, dear all,

I confirm the bug on 9.1.beta4. I opened

https://trac.sagemath.org/ticket/29220

Vincent

Le 19/02/2020 à 03:52, Pat Hooper a écrit :
Hi all,

I've discovered a bizarre bug in repeatedly comparing a rational with an
element of AA:

sage: left_side = AA(2**(1/2) - 2**(1/3))
sage: right_side = 808620184/5240825825
sage: left_side < right_side
True
sage: left_side < right_side
False

The fraction in right_side was obtained via:
continued_fraction(left_side).convergent(15)

One can see because the contined fraction convergents alternate from
smaller than to larger than the number they are approximating, that the
correct answer is True. There seems to be something rather special about
this fraction as demonstrated below:

sage: for n in range(30):
....:     print("{}: {}".format(n, left_side < continued_fraction(left_side
).convergent(n)))
....:
0: False
1: True
2: False
3: True
4: False
5: True
6: False
7: True
8: False
9: True
10: False
11: True
12: False
13: True
14: False
15: False
16: False
17: True
18: False
19: True
20: False
21: True
22: False
23: True
24: False
25: True
26: False
27: True
28: False
29: True

The comparison with the convergent 15 is the only one it gets wrong!
Bizarre...

I first noticed the issue in stable version 8.9, but it seems to still be
present in the development branch.

Best regards,
Pat Hooper



--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/cc0f8a7d-8f60-1758-95e5-30bd3502a20a%40gmail.com.

Reply via email to