Changeset 4249
- Timestamp:
- Feb 9, 2007, 3:26:03 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/utilities/numerical_tools.py
r3945 r4249 26 26 # Note, INF is used instead of NAN (Not a number), since Numeric has no NAN 27 27 # if we use a package that has NAN, this should be updated to use NAN. 28 29 # Static variable used by get_machine_precision 30 machine_precision = None 28 31 29 32 … … 303 306 def get_machine_precision(): 304 307 """Calculate the machine precision for Floats 305 """ 306 307 epsilon = 1. 308 while epsilon/2 + 1. > 1.: 309 epsilon /= 2 310 311 return epsilon 308 309 Depends on static variable machine_precision in this module 310 as this would otherwise require too much computation. 311 """ 312 313 global machine_precision 314 315 if machine_precision is None: 316 epsilon = 1. 317 while epsilon/2 + 1. > 1.: 318 epsilon /= 2 319 320 machine_precision = epsilon 321 322 return machine_precision 312 323 313 324 ####################################################################
Note: See TracChangeset
for help on using the changeset viewer.