[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: The next exercise
From: |
tomas |
Subject: |
Re: The next exercise |
Date: |
Fri, 9 Dec 2022 21:19:00 +0100 |
On Fri, Dec 09, 2022 at 08:58:32PM +0100, Michael Heerdegen wrote:
> Gregory Heytings <gregory@heytings.org> writes:
>
> > M-: (substring (number-to-string (expt 1001 1000)) 0 3) RET
> >
> > "271"
>
> Yes - correct!
>
> My expectation was that someone would try Emacs Calc. Because it can
> compute the number exactly - all digits.
These days, Emacs Lisp can, too (that was my mulling about
the gmp thingy ;-)
So...
(let ((n 1) (exp 1000))
(while (> exp 0)
(setq n (* n 1001) exp (1- exp)))
n)
also gives the exact number (guile is a /dash/ faster, but
Emacs Lisp ain't bad, either ;-)
AFAIK, Emacs uses libgmp for that.
Cheers
--
t
signature.asc
Description: PGP signature
- The next exercise, Michael Heerdegen, 2022/12/09
- Re: The next exercise, Gregory Heytings, 2022/12/09
- Re: The next exercise, Michael Heerdegen, 2022/12/09
- Re: The next exercise,
tomas <=
- Re: The next exercise, Gregory Heytings, 2022/12/09
- Re: The next exercise, Michael Heerdegen, 2022/12/09
- Re: The next exercise, Emanuel Berg, 2022/12/10
- Re: The next exercise, Michael Heerdegen, 2022/12/11
- Re: The next exercise, Emanuel Berg, 2022/12/15
- Re: The next exercise, Michael Heerdegen, 2022/12/15
- Re: The next exercise, Michael Heerdegen, 2022/12/15
- Re: The next exercise, Michael Heerdegen, 2022/12/15
- Re: The next exercise, Emanuel Berg, 2022/12/17
- Re: The next exercise, Michael Heerdegen, 2022/12/17