A function to compare floating point numbers. Numbers in computers are internally represented in binary, and there are some floating point numbers (such as 0.1) that do not have an exact representation in binary. If there is no exact representation in binary, then the value is rounded to the nearest representation in binary, which results in some floating point numbers being slightly imprecise. This imprecision results in some comparisons (such as testing for equality) to not work as expected. Here we implement a function that compares two floating point numbers by using an epsilon value (error margin) that takes into account floating point imprecision.
-
Notifications
You must be signed in to change notification settings - Fork 0
Nerdylicious/FloatingPointComparison
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
C++ implementation to compare two floating point numbers.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published