On Wed 13/06/18 20:28 , Florian Klämpfl
flor...@freepascal.org sent:
> Am 12.06.2018 um 14:42 schrieb J. Gareth
Moreton:
>
> > Hi everyone,
>
> >
>
> > Sorry to flood the mailing list again
with more
> ideas and experiments.
> >
>
> > I would like to propose introducing a
new pair
> of
Am 12.06.2018 um 14:42 schrieb J. Gareth Moreton:
Hi everyone,
Sorry to flood the mailing list again with more ideas and experiments.
I would like to propose introducing a new pair of in-built functions for the
compiler.
function FLog2(X: Cardinal): Cardinal;
function CLog2(X: Cardinal):
I started to think about such names while
sleeping on it. Something like BitCount
would work splendidly for FLog2, and a
note in the documentation can be made to
show the similarity to the binary
logarithm. BinSearchSize is a little
restrictive, but I'm sure something
similar can be found.
Why not call them UIntSize instead of FLog2 and BinSearchSize forCLog2?
That would give an indication of how to use them, and class them along
SizeOf, for finding them easily. After all, you are looking for the size
of a variable?
Wolf
On 13/06/2018 12:13, J. Gareth Moreton wrote:
I can
I can see where you're coming from here.
If not a logarithm, what would you call
these functions that concisely and
compactly describes their behaviour and
purpose? While "bit scan reverse" is
effectively a truncated log2, with a flag
set if the input was zero, it's not a name
that jumps
On 13/06/2018 11:07, J. Gareth Moreton wrote:
Well, I would argue that when computing log(x) of any base, as x tends
to 0 from a positive number, log(x) becomes a progressively more
negative number to the point that, yes, it's undefined, but that's
only going by the definition of limits.
Well, I would argue that when computing log(x) of any base, as x tends to
0 from a positive number, log(x) becomes a progressively more negative
number to the point that, yes, it's undefined, but that's only going by the
definition of limits.
The issue here is that my proposed logarithm
Hi
I object to one component of Gareth's proposal - to make log2(0)=0. The
problem lies not with what Gareth wants to do with it, but what other
people will use it for once it becomes available. log2(0) is undefined
(and undefinable, as it is not a computable number), the appropriate
choice
That would be nice, but I don't think Free
Pascal supports such a concept, at least
not yet. It would certainly be much more
flexible and allow such functions to be
distributed as part of a mathematical
package, say.
The concept of a pure function is useful
to determine for other purposes