From: <tomas@tuxteam.de>
To: help-gnu-emacs@gnu.org
Subject: Re: The next exercise
Date: Fri, 9 Dec 2022 21:19:00 +0100 [thread overview]
Message-ID: <Y5OYNCv7ztCmSF5E@tuxteam.de> (raw)
In-Reply-To: <87edt8tklz.fsf@web.de>
[-- Attachment #1: Type: text/plain, Size: 690 bytes --]
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
next prev parent reply other threads:[~2022-12-09 20:19 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-09 19:09 The next exercise Michael Heerdegen
2022-12-09 19:42 ` tomas
2022-12-09 20:38 ` Michael Heerdegen
2022-12-10 2:09 ` Emanuel Berg
2022-12-10 6:18 ` tomas
2022-12-10 7:28 ` Emanuel Berg
2022-12-10 2:05 ` Emanuel Berg
2022-12-09 19:44 ` Gregory Heytings
2022-12-09 19:58 ` Michael Heerdegen
2022-12-09 20:19 ` tomas [this message]
2022-12-09 20:33 ` Gregory Heytings
2022-12-09 20:51 ` Michael Heerdegen
2022-12-09 21:27 ` Emanuel Berg
2022-12-12 1:34 ` Michael Heerdegen
2022-12-15 5:29 ` Emanuel Berg
2022-12-15 22:24 ` Michael Heerdegen
2022-12-15 23:17 ` Michael Heerdegen
2022-12-16 1:16 ` Michael Heerdegen
2022-12-17 0:20 ` Emanuel Berg
2022-12-18 0:11 ` Michael Heerdegen
2022-12-20 4:45 ` Emanuel Berg
2022-12-11 19:48 ` Andy Moreton
2022-12-12 1:39 ` Michael Heerdegen
2022-12-15 10:47 ` Emanuel Berg
2022-12-10 2:25 ` Emanuel Berg
2022-12-09 20:43 ` Emanuel Berg
2022-12-09 21:29 ` Michael Heerdegen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y5OYNCv7ztCmSF5E@tuxteam.de \
--to=tomas@tuxteam.de \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.