From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Christopher Dimech Newsgroups: gmane.emacs.help Subject: Re: Floating Point computations in elisp Date: Sun, 20 Dec 2020 04:43:25 +0100 Message-ID: References: <87mtybyrd1.fsf@zoho.eu> <87ft41b90r.fsf@zoho.eu> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8106"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: moasenwood@zoho.eu Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 20 04:43:52 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kqpdQ-000217-JE for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 20 Dec 2020 04:43:52 +0100 Original-Received: from localhost ([::1]:39960 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kqpdP-00078T-M9 for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 19 Dec 2020 22:43:51 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55814) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kqpd6-00078F-Ln for help-gnu-emacs@gnu.org; Sat, 19 Dec 2020 22:43:32 -0500 Original-Received: from mout.gmx.net ([212.227.15.18]:49067) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kqpd2-0002VF-82 for help-gnu-emacs@gnu.org; Sat, 19 Dec 2020 22:43:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1608435805; bh=v2MWI5YlWuhN3D+Dvturk/lweJbAoZD6hky5+Jz/3z0=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=SpB6Yv4tT9+7iXk+tFTfY1m8u9IXAOe6kRi7LY6sY6wzxhuXXzQPMvBhgvowgPjud cUcL3LBWyo++J4wr6oC58LvFEuQyfbtTAQmzRcQSTv26hFvY9C+J4zOx2u52UZRa9B HvxsxyeaKdezJYq+4Tl8h8cpaRD60NN2fHoWB7Xo= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [213.165.168.94] ([213.165.168.94]) by web-mail.gmx.net (3c-app-mailcom-bs06.server.lan [172.19.170.174]) (via HTTP); Sun, 20 Dec 2020 04:43:25 +0100 Importance: normal Sensitivity: Normal In-Reply-To: <87ft41b90r.fsf@zoho.eu> X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:8FxxOstvWI3O0QwQMwGm8FTJsPavsyMlFjfHlgAN/Wlxa1kA7boDGWiGmXQ8D4chfBXWt Oa/4IcpvoqcsdlWcXAt74Pgp+52ctgtOSQXtm9FuNZqDjww7u0xSaLs9p+2OoKI07KmxCYd3avp8 RO9lsR/8HNkx1z3v47Z+e0capz9/CUjajhhfy2YoU62FBOZ3NcXbvYYOuDQSrIpn+Qeh875Vy69N 0itO6c/9Hb5vTskM0V61p8tVKfcJfn59PFSIQ4I6fEQyPpPKmf2jM3dJVWmxEOxkOMOVMbEQ4Ee8 H0= X-UI-Out-Filterresults: notjunk:1;V03:K0:y+ZWXLdWtIk=:aeD6SHlP+yovnyGO6uVIqA gMm+4vANzIrSOBq1XDS3BTd0lfRz4O/k2aNrvwIRemJpfX3H1qYUISpulsVl7npEGaGrm/YPJ PUTH1vG3md290iY9ip6GK/0tZYlgS/KOZq7DFJ16Ovdqp6j7ZIhyooe9txFmn6JhVrUJE6SXs Qky3N01lk6oj2C9G1lyoOqvXz9xwE1mkr87aFYCyzNch4ZQjHYfCpMuAS/pvVKtw0DlLxSi6O HnNOt+trLdMta/l3qYG/wfrR/eBt247/XCbuNCuoqParmxO71cax+wWOeGvsshwM9matt911d VHK/H31qRu2QC/uJ9kEroO1VhvJyAIKJ0Elp6iwC1VQiZBWpW33EUCHyVjc7wEV6FFtuXKty6 fHXy+ol/rk2c9eGgVoCiYmxggAboTr9jc3TLnw2kaksUVxFt9Xas38n5/h5GW9bEQIn7ttTgp E4IOHZHYSO0Fice3hjoHXOcu6+iFOHpZqKO26zRrjEoP4lcIwqRherK6bL2Opyk5EeYI6DSdc gSn6TAc6INJiY9DCRe+SjD+9zsMRIHpNQVoqFFGAD8x5FTOLjec5sB6XAcfWPacLYXHFod07v ixyNrH1UATpi4= Received-SPF: pass client-ip=212.227.15.18; envelope-from=dimech@gmx.com; helo=mout.gmx.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:126596 Archived-At: > Sent: Sunday, December 20, 2020 at 6:15 AM > From: "Emanuel Berg via Users list for the GNU Emacs text editor" > 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 > > [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 > > >