Re: [sympy] Interface promise of conversion to float

2021-12-14 Thread Aaron Meurer
I'm not sure if the SymPy docs mention it (you'd have to search). The mpmath docs might, which is what SymPy is using under the hood to do the rounding. Aaron Meurer On Tue, Dec 14, 2021 at 10:56 AM Damien Desfontaines wrote: > > Thanks! Round-to-even in base-2 is perfect for my use case. Is

Re: [sympy] Interface promise of conversion to float

2021-12-02 Thread Aaron Meurer
I believe it uses round-to-even, but note that the rounding is done in base-2, not base-10. If you're worried about the rounding, you can evaluate the number to more digits using evalf() to see exactly how it rounded. If you want to use a specific base-10 rounding mode, I believe currently the

[sympy] Interface promise of conversion to float

2021-12-02 Thread Damien Desfontaines
Hi all, This feels like a very simple problem, but I couldn't find a clear answer in the documentation. I have a sympy number x and I would like to round it to the nearest float. Suppose I simply use float(x), and that the true value of x is between two successive floats a and b. - If x is