Ruud H.G. van Tol on Thu, 09 Mar 2023 14:47:25 +0100


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

Re: logint() bug?



Or use something like:

my_logint(x, b) = if( x >= 1, logint(x, b), -logint(1/x, b) )


But beware:

? floor( log(0.9) / log(2) )
%1 = -1

? my_logint( 0.9, 2 )
%2 = 0

-- Ruud


On 2023-03-09 12:08, Max Alekseyev wrote:
I'd assume logint(x,b) is just an accurate implementation of floor( log(x) / log(b) ) and from this perspective I do not see why there is a need to restrict it to x >= 1. Let it have the same domain as log(x), that is x > 0, and make it work there.
Regards,
Max

    [...] 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)