Karim Belabas on Thu, 09 Mar 2023 10:03:46 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: logint() bug?


* Bill Allombert [2023-03-09 09:52]:
> On Wed, Mar 08, 2023 at 10:19:12PM -0500, Max Alekseyev wrote:
> > I see the following inconsistent results, while in both cases I expect the
> > result to be -1. Bug?
> > 
> > ? logint(.5,2)
> > %1 = 0
> > 
> > ? logint(1/2,2)
> >   ***   at top-level: logint(1/2,2)
> >   ***                 ^-------------
> >   *** logint: domain error in logint: x <= 0
> >   ***   Break loop: type 'break' to go back to GP prompt
> 
> This is why my original implementation of logint only allowed integers...

Yes, the documentation is faulty: logint(x, b) should require
x >= 1 real number (instead of x > 0).

It may work in other cases, but the implementation doesn't support it
(and there's no way to support it efficiently)

I'll fix the doc.

Cheers,

    K.B.
--
Pr Karim Belabas, U. Bordeaux, Vice-président en charge du Numérique
Institut de Mathématiques de Bordeaux UMR 5251 - (+33) 05 40 00 29 77
http://www.math.u-bordeaux.fr/~kbelabas/
`