William Stein | 3 Sep 05:36
Picon
Gravatar

Re: [Bug 136879] Cython doesn't understand ** operator.

On 9/2/07, Chris Mellon <arkanes@...> wrote:
> Looking at the HG history, it looks like it's because it returns a
> double, and presumably the automatic float/int conversion was a
> problem.
>
> I'm looking at the source right now, but it should be possible to just
> use the C ** operator instead, shouldn't it?

There is no C ** operator.  Maybe you are thinking of FORTRAN,
which does have a ** operator, I think.  To compute a power in C,
one has to use a (library) function, I think.

 -- Wiliam

>
> On 9/2/07, William Stein <wstein@...> wrote:
> > Hi Robert,
> >
> > Maybe you can respond to this about why we disabled ** in some
> > cases in Cython.  I can't remember exactly why, except it was
> > in fact a *very* good idea to do so, and helped deal with numerous
> > bugs we had.
> >
> >  -- William
> >
> > ---------- Forwarded message ----------
> > From: arkanes <arkanes@...>
> > Date: Sep 2, 2007 5:26 PM
> > Subject: [Bug 136879] Cython doesn't understand ** operator.
> > To: wstein@...
> >
> >
> > Public bug reported:
> >
> > Following minimal file:
> >
> > cdef int a = 10
> > a ** 20
> >
> >
> > Cython will fail to compile with the error:
> >
> > /home/arkanes/euler.pyx:2:2: Invalid operand types for '**' (int; long)
> >
> >
> > Casting the int literal to a long gives the same error, just with type (int;int)
> >
> > Pyrex 0.9.5 can compile this, and uses the c library pow() for the
> > operation, so this is a regression.
> >
> > ** Affects: cython
> >      Importance: Undecided
> >          Status: New
> >
> > --
> > Cython doesn't understand ** operator.
> > https://bugs.launchpad.net/bugs/136879
> > You received this bug notification because you are a member of Cython-
> > dev, which is the bug contact for Cython.
> >
> >
> > --
> > William Stein
> > Associate Professor of Mathematics
> > University of Washington
> > http://www.williamstein.org
> >
>

--

-- 
William Stein
Associate Professor of Mathematics
University of Washington
http://www.williamstein.org

Gmane