Basic, general functions and constants.

pymeeus.base.TOL = 1e-10

Internal tolerance being used by default


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)
>>> get_ordinal_suffix(101)
>>> get_ordinal_suffix(2)
>>> get_ordinal_suffix(19)
>>> get_ordinal_suffix(23)

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)
>>> iint(19.95)
>>> iint(-2.4)

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