Elektrine lite

← Feed

@simon_brooke@mastodon.scot

Post #1782128

2026-04-27 07:10 UTC

@screwlisp **but**, if you convert an integer to ratio, then the divisor will necessarily be one; so if it is true that "... an implementation [of expt] might choose to compute (expt x 3/2) as if it had been written (sqrt (expt x 3))" (and at this time in the morning I am not awake enough to evaluate this in my head), then yes, the value of `(expt 3/4 3)` should be a complex number. But if that's so, why is (expt 0.75 3) not also a complex number?

Replies (2)

  • @vnikolov@ieji.de 2026-04-27 17:15

    @simon_brooke wrote: «the value of `(expt 3/4 3)` should be a complex number. But if that's so, why is (expt 0.75 3) not also a complex number?» There must be a typo or two here, but I can't figure out what they might be: (expt 3/4 3) => 27/64 and (expt 0.75 3) ≡ (float 27/64) and both are real numbers. The issue must be something else... @screwlisp

    Open ##1782129

  • @vnikolov@ieji.de 2026-04-27 17:38

    P.S. Maybe redundantly: @simon_brooke quoted: "... an implementation [of expt] might choose to compute (expt x 3/2) as if it had been written (sqrt (expt x 3))" Note that this is particularly interesting e.g. in an implementation where (sqrt 4) => 2 rather than (sqrt 4) => 2.0 In such an implementation it is likely that (expt 4 3/2) => 8 rather than (expt 4 3/2) => 8.0 @screwlisp

    Open ##1782130