Demmel, Applied Numerical Linear Algebra, SIAM, 1997. But the correct value depends on both your application and your algorithm. I noticed in the documentation for version 2.6.1 that there is an epsilon attribute in sys.float_info, so I would use twice that value as the default epsilon. If something besides a floating point value is provided, a TypeError is raised.Īt this point, the only difficult thing is setting the correct value for epsilon. If either the exact or the approximate value is zero, than the error is equal to the value of the other. Raise TypeError,"Second argument is not a float." Raise TypeError,"First argument is not a float." def roundoff_error(exact, approximate):ĭef float_equal(float1, float2, epsilon=2.0e-9):
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |