clipper
Floating Point Numeric Classes

Floating Point Numeric Classes ***

This part contains three classes implementing floating point numbers with different precisions and properties. These are later used for all calculations requiring a "Numeric" type and define many common math functions like sqrt() and also most C++ arithmetic operators.

The first class Fraction keeps numerator and denominator of a rational number separately, and supports pretty-printed using LaTeX's {} command. The purpose of this class is to output nicely formatted fractions and it should not be used for serious calculations.

The second class Double takes a standard hardware floating-point type as template parameter: "float", "double" and "long double" are valid choices. It defines all later required operations using the standard libc implements of e.g. sqrt(), cbrt(), sin() and so on. Most of this is done using <cmath>, but some explicit template specializations were necessary to correctly switch between other libc functions.

The final class MpfrFloat utilizes the GNU multi-precision float library with rounding to create a "Numeric" implementation with a fixed arbitrary precision. All necessary C++ arithmetic operators are overloaded in implemented using appropriate mpfr_functions.

 All Classes Files Functions Variables Typedefs Friends Defines