all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Christopher Dimech <dimech@gmx.com>
To: moasenwood@zoho.eu
Cc: help-gnu-emacs@gnu.org
Subject: Re: Floating Point computations in elisp
Date: Sun, 20 Dec 2020 04:43:25 +0100	[thread overview]
Message-ID: <trinity-826dff4a-f295-4ff2-a190-702b6dee6a8a-1608435805791@3c-app-mailcom-bs06> (raw)
In-Reply-To: <87ft41b90r.fsf@zoho.eu>



> Sent: Sunday, December 20, 2020 at 6:15 AM
> From: "Emanuel Berg via Users list for the GNU Emacs text editor" <help-gnu-emacs@gnu.org>
> To: help-gnu-emacs@gnu.org
> Subject: Re: Floating Point computations in elisp
>
> Jean Louis wrote:
>
> > * Emanuel Berg via Users list for the GNU Emacs text editor
> > <help-gnu-emacs@gnu.org> [2020-12-18 20:09]:
> >
> >> (defun compute-space-distance (dist num-beams beam-width)
> >>   (let*((spaces         (1+ num-beams))
> >>         (dist-covered   (* num-beams beam-width))
> >>         (dist-uncovered (- dist dist-covered))
> >>         (space          (/ dist-uncovered spaces 1.0) ))
> >>     space ))
> >>
> >> ;; (insert (format "\n;; %.2f" (compute-space-distance 262 16 12)))
> >> ;; 4.12
> >
> > If I wish to arrive to Tau Ceti from Earth and it is maybe 11.8 light
> > years distant, how many years do I need to get there provided I trave
> > 5,000 km per hour?
>
> How about: 2 548 584 years

The ultimate question is then, how much will it cost.  :)

> (defun tau-ceti (speed)
>   (let*((dist       (* 11.8 9.46 (expt 10 12)))
>         (time       (/ dist speed) )
>         (days       (/ time 24))
>         (whole-days (round days)) )
>     (format-seconds "%y years"
>                     (- (float-time (encode-time 0 0 0 whole-days 0 0))
>                        (float-time (encode-time 0 0 0 0 0 0)) ))))
> ;; (tau-ceti 5000)
>
> --
> underground experts united
> http://user.it.uu.se/~embe8573
> https://dataswamp.org/~incal
>
>
>



  reply	other threads:[~2020-12-20  3:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-18  8:17 Floating Point computations in elisp Christopher Dimech
2020-12-18  8:22 ` Michael Heerdegen
2020-12-18  8:34   ` Christopher Dimech
2020-12-18 11:07   ` Jean Louis
2020-12-18 17:08 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-18 18:21   ` Jean Louis
2020-12-20  0:38     ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-20  0:42     ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-20  0:45     ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-20  3:43       ` Christopher Dimech [this message]
2020-12-20  4:14         ` Stefan Monnier
2020-12-20  4:19           ` Christopher Dimech

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=trinity-826dff4a-f295-4ff2-a190-702b6dee6a8a-1608435805791@3c-app-mailcom-bs06 \
    --to=dimech@gmx.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=moasenwood@zoho.eu \
    /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.