In doing a matlab script into the python code, matlab infinity can be directly used inf
to represent, may be infinitesimal -inf
, but can not be used directly in Python, you need to use float("inf")
, summary records about
minDiff = INF
minDiff = inf
Error message: unresolved reference INF, unresolved reference inf
Corrected to
minDiff = float("inf")
No error message, normal execution
Simple example
minDiff = float("inf")
a = 200000
if a<minDiff:
print("yes")
Output
yes
minDiff = float("-inf")
a = -200000
if a>minDiff:
print("yes")
Output
yes