Skip to content

Come up with a new version of expt #929

Description

@jpellegrini

@egallesio since you suggested that we had sqrt call expt, I have been looking into it, and I think it would make sense to rewrite expt completely, and indeed make sqrt call it. I'm working on it, and I opened this issue to let you know.

So far the first version of expt would work like the following (things may be changed later for more precision or efficiency, but this would be a good start):

static SCM my_expt_new(SCM x, SCM y) {
/*
      x         y     result
============================
----------------------------  y = 0:
                0     1
----------------------------  x = 0, 1:
       1              1
       0      < 0     error
       0      >=0     0
----------------------------  y = 1, 1.0:
                1     x
              1.0    inex(x)
----------------------------  x REAL:
] 0.0,+1.0[   +big   +0.0
]-1.0, 0.0[   +big   0.0 * parity(y)
   +real      +big   +inf.0
   -real      +big   +inf.0 * parity(y)
    real   +fixnum   expt_real_positivefixnum
    real      real   pow(x,y)
   +-0.0 +rational   0.0
   +-0.0 -rational   +inf.0
   +real +rational   pow(x,inexact(y)) or exp( log(x) * y )
   -real +rational   make-rect(0,  real_part( exp( log(x) * y ) ) )
    real   complex   exp( log(x) * y )
    real       < 0   1 / exp(x,-y)
---------------------------- x EXACT except 0, 1:
   exact      +big   error
   exact   +fixnum   expt_exact_positivefixnum
   exact   -fixnum   1 / exp(x,-y)
   exact  rational   TODO
   exact      real   make-rect(0,  real_part( exp( log(x) * y ) ) )
   exact   complex   exp( log(x) * y )
---------------------------- x COMPLEX:
 complex             exp( log(x) * y )

*/

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions