emacs-devel
[Top][All Lists]
Advanced

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

Re: [NonGNU Elpa] New package: ETT


From: John Task
Subject: Re: [NonGNU Elpa] New package: ETT
Date: Wed, 03 May 2023 15:06:13 -0300

Philip Kaludercic <philipk@posteo.net> writes:

> If that is so, I would explain that in the documentation string, but
> what I wonder is why if condition is needed.  All you basically do is
> avoid converting num1 to a float, and the result remains a integer, in
> some cases.

Oh, I get what you mean now.  Well, back when I coded this I prefered
the result being an integer when the result was exact.  It simplified
some maths for me.  However, nowadays this function is used only four
times in the code, so I probably don't need that fallback anymore.

> While this will calculate the values in constant time,
> 
>   (list (floor time 60) (% time 60))
> 
> a loop will always take more iterations depending on the value of the input:
> 
>   (let ((hr 0))
>     (while (>= time 60)
>       (setq hr (1+ hr)
>              time (- time 60)))
>     (list hr time))

Amazing.  Thanks!

Best regards.



reply via email to

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