mathematics know about floating-point arithmeticby david goldbergin computing surveysassociation for computing machinerymarch is also worthy read (this article is easy to find on the internet if you simply search for the titlen the ibm general decimal arithmetic specification contains more information and can be easily located online through search engines fractions the fractions module defines class fraction that represents rational number instances can be created in three different ways using the class constructorfraction([numerator [,denominator]]creates new rational number numerator and denominator have integral values and default to and respectively fraction(fractionif fraction is an instance of numbers rationalcreates new rational number with the same value as fraction fraction(sif is string containing fraction such as " / or "- / " fraction with the same value is created if is decimal number such as " " fraction with that value is created ( fraction( , )the following class methods can create fraction instances from other types of objectsfraction from_float(fcreates fraction representing the exact value of the floating-point number fraction from_decimal(dcreates fraction representing the exact value of the decimal number here are some examples of using these functionsf fractions fraction( , fractions fraction(" " fraction( fractions fraction from_float( fraction( an instance of fraction supports all of the usual mathematical operations the numerator and denominator are stored in the numerator and denominator attributesrespectively in additionthe following method is definedf limit_denominator([max_denominator]returns the fraction that has the closest value to max_denominator specifies the largest denominator to use and defaults to lib fl ff