5

Currently Emacs calculator (calculator not calc) only shows, up to three digit decimal values. For example calculating 22/7 gives 3.143. Is it possible to increase the number of displayed digit decimal in Emacs calculator?

Glorfindel
  • 234
  • 1
  • 5
  • 13
Name
  • 7,689
  • 4
  • 38
  • 84
  • Please clarify which Emacs calculator you are asking about. `calc` or something else? – Drew Feb 13 '15 at 15:03
  • @Drew I think he was clear to begin with. I just didn't know there was an emacs `calculator`, I thought `calc` was it! – Tyler Feb 13 '15 at 15:05
  • 2
    While we are at it, there's also `quick-calc`; I have been using it with my [custom math commands](https://github.com/kaushalmodi/.emacs.d/blob/master/setup-files/setup-calc.el) like `alog10`, `dbv`, `next2pow`, etc – Kaushal Modi Feb 13 '15 at 22:01

3 Answers3

7

In calculator mode, { and } control how many digits are displayed.

Sue D. Nymme
  • 1,406
  • 12
  • 13
2

p

From the manual, available in emacs here:

(info "(calc)Precision")

7.2 Precision

The ‘p’ (‘calc-precision’) command controls the precision to which floating-point calculations are carried. The precision must be at least 3 digits and may be arbitrarily high, within the limits of memory and time. This affects only floats: Integer and rational calculations are always carried out with as many digits as necessary.

The ‘p’ key prompts for the current precision. If you wish you can instead give the precision as a numeric prefix argument.

Tyler
  • 21,719
  • 1
  • 52
  • 92
  • I use calculator by `M-x calculator`. Contrary to the calc-mode (`M-x calc`), it seems that precision `p` doesn't work there. – Name Feb 13 '15 at 14:34
  • Right you are. I'll leave this here for others looking for `calc`, but I see @SueD.Nymme has given you the correct answer for `calculator`. – Tyler Feb 13 '15 at 15:08
1

This is an easy one: p the number entered afterwards controls the precision of floating-point calculations.

wvxvw
  • 11,222
  • 2
  • 30
  • 55
  • For `calc` this works. What about the `calculator` as in my question? – Name Feb 13 '15 at 14:26
  • @Name oh... I haven't even though about it. But I see the answer has already been given. I'll live it until the evening and then remove. No need to duplicate the answers. – wvxvw Feb 13 '15 at 17:31
  • Your answer is still helpful for `calc`. – Name Feb 13 '15 at 17:38