www.delorie.com/gnu/docs/calc/calc_149.html   search  
 
Buy the book!


GNU Emacs Calc 2.02 Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.4.3 Fraction Mode

Division of two integers normally yields a floating-point number if the result cannot be expressed as an integer. In some cases you would rather get an exact fractional answer. One way to accomplish this is to multiply fractions instead: 6 RET 1:4 * produces 3:2 even though 6 RET 4 / produces 1.5.

To set the Calculator to produce fractional results for normal integer divisions, use the m f (calc-frac-mode) command. For example, 8/4 produces 2 in either mode, but 6/4 produces 3:2 in Fraction Mode, 1.5 in Float Mode.

At any time you can use c f (calc-float) to convert a fraction to a float, or c F (calc-fraction) to convert a float to a fraction. See section 8.4 Conversions.


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003