Sunday 8 December 2019

compare float number in python

Greeting All,




I want to compare float number that but I don't wanna round the number
here is a simple example:



p = 15.0060732
n = 15.00637396

if p == n:
print('=')
if p > n:

print('>')
if p < n:
print('<')


I want p < n , is there any method to hlpe me do that.
* Note: I have a big table that represent these value but it's random so i can't determin the floating point for all table.



any help will be appreciated

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...