help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to read an integer from the minibuffer


From: Emanuel Berg
Subject: Re: How to read an integer from the minibuffer
Date: Tue, 16 Nov 2021 07:21:38 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Jean Louis wrote:

>>> Should I say "actual number"?
>> 
>> It depends:
>> 
>>   complex    C = ... -3 + 2i, 0, 1 + 3i ...                          
>>   composite      4, 6, 8, 9, 10, 12 ...
>>   integers   Z = ... -3, -2, -1, 0, 1, 2, 3 ...
>>   irrational F = ... \pi, \sqrt{2}, 0.121221222 ...
>>   natural    N = 1, 2, 3, 4 ...
>>   prime      P = 2, 3, 5, 7, 11, 13, 17 ...
>>   rational   Q = -\frac{1}{2}, 0.33333 ... \frac{5}{2}, \frac{11}{10} ... 
>>   real       R = ... -3, -1, 0, \frac{1}{5}, 1.1, \sqrt{2}, 2, 3, \pi ...
>>   whole      W = 0, 1, 2, 3, 4 ...
>> 
>> https://davenport.libguides.com/math-skills-overview/basic-operations/sets
>
> I would just check for those numbers that are accepted by
> Emacs Lisp.
>
> 2i does not evaluate, thus I cannot use that one.

You can use complex/imaginary numbers in Elisp, e.g.

  (calc-eval "1 + 2i + 3")

Or

  (calcFunc-add 3 '(float 5 0) '(cplx 4 5)) ; (cplx (float 12 0) 5)

See here for more discussion:

  
https://stackoverflow.com/questions/28629797/complex-imaginary-numbers-in-elisp

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]