Re: master 3843711 3/3: Simplify calculator-expt

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: master 3843711 3/3: Simplify calculator-expt

Juanma Barranquero

On Tue, Nov 5, 2019 at 8:40 AM Paul Eggert <[hidden email]> wrote:

> +    (overflow-error
> +     (if (or (natnump x) (cl-evenp y))
> +        1.0e+INF
> +       -1.0e+INF))))

That introduces a run-time dependency on cl-lib:

  ELC      calculator.elc

In end of data:
calculator.el:1644:1:Warning: the function `cl-evenp' might not be defined at
    runtime.

Reply | Threaded
Open this post in threaded view
|

Re: master 3843711 3/3: Simplify calculator-expt

Stefan Monnier
> -           ((eq (logand (truncate y) 1) 1)   ; expansion of cl `oddp'
> [...]
> +     (if (or (natnump x) (cl-evenp y))

`cl-evenp` doesn't do the `truncate` part, so this will signal an error if
`x` is not a natural number and `y` is not an integer.


        Stefan


Reply | Threaded
Open this post in threaded view
|

Re: master 3843711 3/3: Simplify calculator-expt

Paul Eggert
In reply to this post by Juanma Barranquero
On 11/5/19 3:28 AM, Juanma Barranquero wrote:

> calculator.el:1644:1:Warning: the function `cl-evenp' might not be
> defined at runtime.
Thanks, I installed the attached to pacify the byte-compiler about that.
(Remind me again why cl-lib is not preloaded? :-)

0001-Pacify-byte-compiler-in-calculator.el.patch (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: master 3843711 3/3: Simplify calculator-expt

Paul Eggert
In reply to this post by Stefan Monnier
On 11/5/19 11:29 AM, Stefan Monnier wrote:

>> +     (if (or (natnump x) (cl-evenp y))
>
> `cl-evenp` doesn't do the `truncate` part, so this will signal an error if
> `x` is not a natural number and `y` is not an integer.

Not a problem, as this part of the code is reachable only if Y is an
integer. I added a comment to that effect.