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

GNU Emacs Calc 2.02 Manual

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

7.7.5 Fraction Formats

Display of fractional numbers is controlled by the d o (calc-over-notation) command. By default, a number like eight thirds is displayed in the form `8:3'. The d o command prompts for a one- or two-character format. If you give one character, that character is used as the fraction separator. Common separators are `:' and `/'. (During input of numbers, the : key must be used regardless of the display format; in particular, the / is used for RPN-style division, not for entering fractions.)

If you give two characters, fractions use "integer-plus-fractional-part" notation. For example, the format `+/' would display eight thirds as `2+2/3'. If two colons are present in a number being entered, the number is interpreted in this form (so that the entries 2:2:3 and 8:3 are equivalent).

It is also possible to follow the one- or two-character format with a number. For example: `:10' or `+/3'. In this case, Calc adjusts all fractions that are displayed to have the specified denominator, if possible. Otherwise it adjusts the denominator to be a multiple of the specified value. For example, in `:6' mode the fraction 1:6 will be unaffected, but 2:3 will be displayed as 4:6, 1:2 will be displayed as 3:6, and 1:8 will be displayed as 3:24. Integers are also affected by this mode: 3 is displayed as 18:6. Note that the format `:1' writes fractions the same as `:', but it writes integers as n:1.

The fraction format does not affect the way fractions or integers are stored, only the way they appear on the screen. The fraction format never affects floats.

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