Questions tagged [numbers]
33 questions
7
votes
2 answers
Quickly Evaluate Infix Math Expression?
Is there a way to highlight and quickly evaluate a simple math expression without using elisp notation? For example, we can already evaluate the elisp expression (+ 1 1) in the following text snippet by putting point behind it and pressing C-x…

George
- 879
- 5
- 17
6
votes
1 answer
minor mode to display long integers?
I have to deal with long integers frequently, typically 9+ digits, and all of the digits matter (so scientific notation doesn't help me. Is there a minor mode that helps make it easier to visually scan such numbers? I encounter these numbers both…

petermao
- 83
- 4
5
votes
3 answers
How to increase the number of displayed digit decimals in Emacs calculator
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?

Name
- 7,689
- 4
- 38
- 84
2
votes
3 answers
How can I check whether a string represents a number in Elisp?
I want to check whether the string variable s is a number (integer or float) formatted as a string. I thought it could be done using string-to-number like this
(defun string-number-base-p (s)
(when (or (equal "0" s)
(not (equal 0…

orgtre
- 1,012
- 4
- 15
2
votes
1 answer
Does anyone know of a quick method to get hexadecimal line numbers in emacs?
Does anyone know of a quick method to get hexadecimal line numbers in emacs?
I am using linum for line numbers. I suppose I could hack it, but just thought to ask first.

Roadowl
- 131
- 3
2
votes
2 answers
Representing leading zeroes in a list
I would like to have this table
#+NAME: addition-table
| | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
|---+----+----+----+----+----+----+----+----+----+----|
| 0 | 00 | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 |
| 1 | 01 | 02 | 03 | 04 |…

147pm
- 2,907
- 1
- 18
- 39
2
votes
2 answers
Treat all numbers as floats
Is there a way to get elisp to automatically treat all numeric variables as floating points without having to repeatedly use the float function?
For example to a division function that outputs the "true" quotient is
(defun divide ( x y )
(/ (float…

Quinn Culver
- 157
- 6
2
votes
1 answer
How insert random number?
Suppose I has text:
test hello
The cursor is after word test. I need to insert random number? Also I need to set range of random (e.g. from 0 to 1000)
The result maybe like this:
test100 hello

a_subscriber
- 3,854
- 1
- 17
- 47
2
votes
1 answer
How to replace a digit by a letter?
I want to replace some digits by letters such that
1 ---> a
2 ---> b
...
In emacs I have tried the following replacement:
M-x query-replace-regexp RET \([0-9]+\) RET \,(string (+ ?a \#1)) RET
It works, but in replacement I obtain 1 --> b, 2 --> c,…

Onner Irotsab
- 431
- 2
- 9
2
votes
1 answer
How to use fixed point decimals in emacs lisp?
How to use large decimal numbers with fixed precision, like money amount, in emacs lisp? For example, I'm writing a function that takes amount of money as a parameter. When I pass large float like 999999999999999.01 it looses precision and becomes…

Max Skyfire
- 21
- 1
2
votes
1 answer
How should one interpret the printed representation of integers in Emacs Lisp?
I'm getting to grips with Emacs Lisp in GNU Emacs 25.3.2. While trying to understand the printed representation of integers I got confused by the following echo area output produced by C-x C-e:
10
-> 10 (#o12, #xa, ?\C-j)
I gather from the manual…

Andrew L
- 23
- 2
2
votes
2 answers
floating-point addition
Why am I getting these results?
(+ 5.2 42.4 -1) 46.6
(+ 5.2 42.45 -1) 46.650000000000006
Couldn't the 2nd operation just output 46.65? Where does the 0000000000006 come from?

Quora Feans
- 515
- 3
- 11
2
votes
2 answers
How can I use a char as a counter?
I have this LaTeX code:
\begin{enumerate}[a]
\affiliation{...}
\affiliation{...}
\affiliation{...}
...
\affiliation{...}
\end{enumerate}
and, using a script written in Emacs Lisp, I want to…

Onner Irotsab
- 431
- 2
- 9
2
votes
1 answer
Why does (format "%x" some-large-number) produces incorrect results?
I wanted the hexadecimal string for a large integer such as below:
(format "%x" 2738188573457603759)
This returns 2600000000f95c00 which is incorrect, it should be 2600000000f95caf.
The value of most-positive-fixnum on my box is 0x1fffffffffffffff…

David Sitsky
- 21
- 1
2
votes
0 answers
In Emacs Lisp, how to convert roman numerals to an integer?
In Emacs Lisp, how to write an Emacs Lisp function to convert a natural number from roman numerals representation to the equivalent Emacs Lisp integer value? The Emacs Lisp function should be callable from Emacs Lisp and return an Emacs Lisp integer…

Low Powah
- 307
- 1
- 9