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

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

Re: Floating Point computations in elisp


From: Emanuel Berg
Subject: Re: Floating Point computations in elisp
Date: Sun, 20 Dec 2020 01:38:25 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Jean Louis wrote:

> 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?

I don't know, 215 981 years?

(defun tau-ceti (speed)
  (let*((dist  (* 9.46 (expt 10 12)))
        (time  (/ dist speed) )
        (hours (round time)) )
    (format-seconds "%y years"
                    (- (float-time (encode-time 0 0 hours 0 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 via email to

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