Trees | Indices | Help |
|
---|
|
1 ############################################################################### 2 # # 3 # Copyright (C) 2013 Edward d'Auvergne # 4 # Copyright (C) 2014 Troels E. Linnet # 5 # # 6 # This file is part of the program relax (http://www.nmr-relax.com). # 7 # # 8 # This program is free software: you can redistribute it and/or modify # 9 # it under the terms of the GNU General Public License as published by # 10 # the Free Software Foundation, either version 3 of the License, or # 11 # (at your option) any later version. # 12 # # 13 # This program is distributed in the hope that it will be useful, # 14 # but WITHOUT ANY WARRANTY; without even the implied warranty of # 15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 16 # GNU General Public License for more details. # 17 # # 18 # You should have received a copy of the GNU General Public License # 19 # along with this program. If not, see <http://www.gnu.org/licenses/>. # 20 # # 21 ############################################################################### 22 23 # Module docstring. 24 """Module for basic mathematical operations.""" 25 26 # Python module imports. 27 from math import ceil, log10 28 2931 """Determine the order of magnitude of the given number. 32 33 For example, the number 1,234 will be give a value of 4.0. 34 35 36 @param value: The value to determine the order of magnitude of. 37 @type value: float or int 38 @return: The order of magnitude. 39 @rtype: float 40 """ 41 42 # Calculate and return the value. 43 return ceil(log10(value))44 4547 """Round the given value up to the next order of magnitude. 48 49 For example, the number 1,234 will be rounded up to 10,000. 50 51 52 @param value: The value to determine the order of magnitude of. 53 @type value: float or int 54 @return: The new value rounded up to the next order of magnitude. 55 @rtype: float 56 """ 57 58 # Calculate and return the value. 59 return 10**(order_of_magnitude(value))60
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sat Jun 8 10:45:11 2024 | http://epydoc.sourceforge.net |