On Sun, 2023-04-16 at 19:46 -0700, aw wrote: > > Unbelievable. > This is failing a basic consistency check: if x==y, then we should have > f(x)==f(y) for any function f. > > The problem here is that float literals are being mishandled. The string > "0.5" should be interpreted as 1/2, unless the user overrides that. > > Can you post the other "permabugs" you know of that involve float literals? >
They're all variations on a theme. Floating point sucks, and Sage inherits that: sage: (0.1 + 0.2) + 0.3 == 0.1 + (0.2 + 0.3) False Whenever you perform an operation with two different types of "number," Sage essentially picks the worst of the two and performs the operation there. Every example is basically, 1. Something returns a float where you don't expect it 2. You use that result with some other object 3. Now the other object is made of float 4. Nothing works in floating point The conversion to float is consistent with all of the other intelligent coercions that Sage can do (embedding ZZ into QQ, for example), so it goes off silently. But floating point is a uniquely bad base ring for most of Sage. -- 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/44b14f57528ac06463e2294fa52cf3a661cc2cc0.camel%40orlitzky.com.