misc functions and math constants