Check if a number is rational in Python, for a given fp accuracy

前端 未结 7 1142
迷失自我
迷失自我 2020-12-19 02:53

I would like to know a good way of checking if a number x is a rational (two integers n,m exist so that x=n/m) in python.

In Mathematica, this is done by the functio

7条回答
提交回复
热议问题