Base

Basic, general functions and constants.

pymeeus.base.TOL = 1e-10

Internal tolerance being used by default

pymeeus.base.get_ordinal_suffix(ordinal)[source]

Method to get the suffix of a given ordinal number, like 1’st’, 2’nd’, 15’th’, etc.

Parameters:ordinal (int) – Ordinal number
Returns:Suffix corresponding to input ordinal number
Return type:str
Raises:TypeError if input type is invalid.
>>> get_ordinal_suffix(40)
'th'
>>> get_ordinal_suffix(101)
'st'
>>> get_ordinal_suffix(2)
'nd'
>>> get_ordinal_suffix(19)
'th'
>>> get_ordinal_suffix(23)
'rd'
pymeeus.base.iint(number)[source]

This method behaves in the same way as the INT() function described by Meeus in his book: Greatest integer which is not greater than number.

Parameters:number (int, float) – Number or expresion
Returns:Greatest integer which is not greater than number
Return type:int
Raises:TypeError if input type is invalid.
>>> iint(19)
19
>>> iint(19.95)
19
>>> iint(-2.4)
-3
pymeeus.base.machine_accuracy()[source]

This function computes the accuracy of the computer being used.

This function returns a tuple containing the number of significant bits in the mantissa of a floating number, and the number of significant digits in a decimal number.

Returns:Number of significant bits, and of significant digits
Return type:tuple