This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
floating_point_comparison [2022/04/29 23:46] max |
floating_point_comparison [2022/04/29 23:54] (current) max |
||
---|---|---|---|
Line 22: | Line 22: | ||
===== The relative method ===== | ===== The relative method ===== | ||
- | The relative method takes the result of the absolute method | + | The relative method takes the absolute method, but multiplies the epsilon by '' |
The drawback to this method is that it does not work on small values. | The drawback to this method is that it does not work on small values. | ||
Line 30: | Line 30: | ||
Considering the strengths and drawbacks of the two methods above, you can combine the two to overcome these limitations. | Considering the strengths and drawbacks of the two methods above, you can combine the two to overcome these limitations. | ||
- | The combined method takes the result of the absolute | + | The combined method takes the relative |
This method gives us good results, but it is not without its drawbacks since it uses the same epsilon for the relative and the absolute tolerance. | This method gives us good results, but it is not without its drawbacks since it uses the same epsilon for the relative and the absolute tolerance. | ||
For further reading, please check out [[http:// | For further reading, please check out [[http:// |