"2*1.1" is not a float literal. Note that RR(2.2) does what you want.
On Monday, April 10, 2023 at 1:42:21 PM UTC-7 aw wrote: > sage version: 9.4 > operating system: fedora 35 > > float literals passed to realfield can yield wrong answers > > example: > > RR=RealField(200) > > print(RR(1.1)) > print(RR(11/10)) > print() > print(RR(2*1.1)) > print(RR(2*11/10)) > > output: > > 1.1000000000000000000000000000000000000000000000000000000000 > 1.1000000000000000000000000000000000000000000000000000000000 > > 2.2000000000000001776356839400250464677810668945312500000000 > 2.2000000000000000000000000000000000000000000000000000000000 > > this bug is trivial to fix > float literals passed to realfield should be automatically cast as a ratio > of sage ints > eg the float literal 1.1 should be cast to 11/10 > -- 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/5d29e9a1-7eb2-4f6c-bdd1-1a795d4bb533n%40googlegroups.com.