Changeset 3849
- Timestamp:
- Oct 24, 2006, 4:14:51 PM (19 years ago)
- Location:
- anuga_core/source/anuga/utilities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/utilities/numerical_tools.py
r3749 r3849 288 288 return bins 289 289 290 290 def get_machine_precision(): 291 """Calculate the machine precision for Floats 292 """ 293 294 epsilon = 1. 295 while epsilon/2 + 1. > 1.: 296 epsilon /= 2 297 298 return epsilon 291 299 292 300 #################################################################### -
anuga_core/source/anuga/utilities/test_numerical_tools.py
r3514 r3849 186 186 187 187 188 def test_machine_precision(self): 189 """test_machine_precision(self): 190 Test the function that calculates epsilon. As this varies on 191 different machines, this is only an indication. 192 """ 193 194 eps = get_machine_precision() 195 196 assert eps < 1.0e-12, 'Machine precision should be better than 1.0e-12' 197 assert eps > 0.0 198 assert 1.0+eps/2 == 1.0 199 200 188 201 def test_histogram(self): 189 202 """Test histogram with different bin boundaries
Note: See TracChangeset
for help on using the changeset viewer.