On Mon, Apr 17, 2023 at 12:20 PM Michael Orlitzky <mich...@orlitzky.com> wrote:
>
> 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.

for some tasks, at least, built-in RBF and CBF does wonders, e.g. for
the example
earlier in the thread:


sage: A = matrix([[-3, 2, 1 ],
....:             [ 2,-4, 4 ],
....:             [ 1, 2,-5 ]])
sage: B = (2 * 0.5 * A)
sage: B.rank() # bad
3
sage: matrix(RBF,B).rank() # right!
2
sage: type(matrix(RBF,B)) # this is not even using what's available in
arb for matrices
<class 'sage.matrix.matrix_generic_dense.Matrix_generic_dense'>

>
> --
> 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.

-- 
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/CAAWYfq38u9%3DdEX0xcY0rHyOgHTfXr%2BFVu0GfF6SKbbK7VpZ79g%40mail.gmail.com.

Reply via email to