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@...
(Continue reading)

Chris Mellon | 3 Sep 05:41
Picon

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

On 9/2/07, William Stein <wstein@...> wrote:
> 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.
>

You can tell how long it's been since I've actually written
non-trivial C, sigh. You're correct, of course. And there's no library
function that does integer power. Perhaps removing the typecheck to
accept ints, while still returning a double is better? This is what C
would do, after all.

Gmane