How do you compare two decimal numbers in python?
jobs 0 Junior Poster in Training
Recommended Answers
Jump to PostI assume you mean floating point numbers. The way they are represented in most computer languages you can have small roundoff errors in the last bit. You have to compare them in narrow range, example:
pi1 = 355/113.0 print pi1 # 3.14159292035 pi2 = 3.14159 delta = …
All 3 Replies
bumsfeld 413 Nearly a Posting Virtuoso
jrcagle 77 Practically a Master Poster
BearofNH 104 Posting Whiz
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.