AngouriMath

Navigation

← Back to list of members

ToSymPyExactly​(AngouriMath.​Entity)

 Method (no overloads)

Summary

The operand written so that SymPy does the arithmetic rather than Python.

Remarks

Python's / and its ** with a negative exponent are float operations on two
integers, so an exact value would leave here inexact: 1 / 2 is 0.5 there,
and sympify(0.5) is a Float and not Rational(1, 2) — the exactness
is gone before SymPy sees the expression, and nothing downstream recovers it. Making one
operand a SymPy integer is enough, since its operators sympify the other side.
Only a pair of integers needs this. With a symbol anywhere in the shape SymPy's own
operators already take over, and +, -, * and a non-negative
** are exact on Python integers, whose precision is unbounded.
https://github.com/asc-community/AngouriMath/issues/911

























Angouri © 2019-2023 · Project's repo · Site's repo · Octicons · Transparency · 1953 pages online