[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Floating Point computations in elisp
From: |
Jean Louis |
Subject: |
Re: Floating Point computations in elisp |
Date: |
Fri, 18 Dec 2020 14:07:52 +0300 |
User-agent: |
Mutt/2.0 (3d08634) (2020-11-07) |
* Michael Heerdegen <michael_heerdegen@web.de> [2020-12-18 11:23]:
> Christopher Dimech <dimech@gmx.com> writes:
>
> > How can I do floating point computations in elisp
> >
> > (setq frc (/ tpd 60.0))
>
> Like (/ (float tpd) 60.0).
Thank you. But in the above example there is decimal 60.0 that would
do the same result.
(eql (/ (float 1) 60.0) (/ 1 60.0))
(eql (/ (float 20) 60.0) (/ 20 60.0))
While this would not be same:
(eql (/ 20 (float 60)) (/ 20 60))
because I did not know `float' I was always adding or using something
like 1.0 in divisions, like:
(/ 10 30 1.0) to get the same effect.
Now when I know `float' I could use:
(/ (float 10) 30)
As it is more descriptive, it gives maybe more explanation in the code
on WHY, as inserting 1.0 there does not necessarily makes it clear
WHY.
- Floating Point computations in elisp, Christopher Dimech, 2020/12/18
- Re: Floating Point computations in elisp, Michael Heerdegen, 2020/12/18
- Re: Floating Point computations in elisp, Emanuel Berg, 2020/12/18
- Re: Floating Point computations in elisp, Jean Louis, 2020/12/18
- Re: Floating Point computations in elisp, Emanuel Berg, 2020/12/19
- Re: Floating Point computations in elisp, Emanuel Berg, 2020/12/19
- Re: Floating Point computations in elisp, Emanuel Berg, 2020/12/19
- Re: Floating Point computations in elisp, Christopher Dimech, 2020/12/19
- Re: Floating Point computations in elisp, Stefan Monnier, 2020/12/19
- Re: Floating Point computations in elisp, Christopher Dimech, 2020/12/19