Open gdalle opened 11 months ago
I haven't done any benchmarking, but I expect they'll be comparable at arithmetic - the algorithms are very similar.
A large benefit of this package is in all the symmetric properties of the hexp
function. It makes it much easier to write branchless code (which is easier to make type stable) - which is typically faster to run as a side effect.
You also don't waste another word of memory on the sign bit (you get to use the sign bit of the underlying value) which probably helps when you have lots of these.
Other symmetries mean that isinf
, isnan
, iszero
, isone
, signbit
, abs
, <
etc all have trivial implementations, some of which will probably be a lot faster.
I'd be interested in a comparison.
Do you think there is any aspect in which HugeNumbers can not replace / improve on LogarithmicNumbers?
Nothing springs to mind - the representations of both are based around logarithms, so implementing functions should be much the same either way.
TBH this package was born out of nerdy perfectionism more than utility - the hexp
function is just so mathematically pleasing. I may never release it.
I mean if it's simpler to code and works basically the same I see no reason not to make it available
The main drawback of LogarithmicNumbers for me is the (inevitable) performance hit of putting every single addition through a
logsumexp
. Is this package the same, slightly worse or slightly better?