Efficient Symmetric level-index arithmetic in D?

H. S. Teoh hsteoh at quickfur.ath.cx
Fri Mar 1 15:35:33 UTC 2019


On Fri, Mar 01, 2019 at 03:02:04PM +0000, Simen Kjærås via Digitalmars-d wrote:
> On Friday, 1 March 2019 at 14:00:46 UTC, Olivier FAURE wrote:
> > On Wednesday, 27 February 2019 at 20:47:34 UTC, Michelle Long wrote:
> > > https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4927227/
> > > https://en.wikipedia.org/wiki/Symmetric_level-index_arithmetic
> > 
> > tl;dr ?
> 
> It's a different way of storing and operating on numbers, essentially.
[...]
> I'd never heard of it before, but found it an interesting idea, like the
> unum format that has been posted here once or twice. Interesting on a
> theoretical level, but probably not useful for D.
[...]

I've encountered such number representations before, in the form of a
Perl script called hypercalc.pl that, paraphrasing the author, allows
you to compute the factorial of the US national debt raised to the power
of the number of atoms in the universe, and make meaningful comparisons
of the result with other humongous numbers.

I've never heard of such a representation being useful outside of pure
mathematical curiosity, though.  For one thing, it (greatly!) expands
the range of representible numbers by (greatly!) diminishing accuracy. A
number like e^e^e^...(n times)..^x has an error margin of roughly
e^e^... (n-1 times), which for any non-trivial values of n is pretty
huge. e^e^1, for example, is "only" around 15, but e^e^e^1 is around
3814279.10476. So e^e^e^e^x has a really big margin of error, and that's
only for n=4. For large values of n, the error is so large it doesn't
even fit in IEEE 754 double(!).  This inaccuracy is most obvious when
subtracting values of equal (or almost equal) magnitude.  Because of the
inherent inaccuracy in the representation, it's often not possible to
tell whether the result of a subtraction is 0, or some number on the
order of magnitude of e^e^...(n-k times)...^x for some small k, which,
for large n, can be so huge you can't even represent it in a IEEE
double. So while inequalities generally work fine, equality is in
general not a very meaningful operation with this representation (except
for exact equality, which in real computations rarely ever happens).

So I don't think such a representation has general applicability in
terms of computations most people would be working with, as opposed to
specialized applications that primarily deal with humongous numbers (or
near-infinitesimal numbers).


T

-- 
Freedom: (n.) Man's self-given right to be enslaved by his own depravity.


More information about the Digitalmars-d mailing list