preprocessor wizardry for integer exponentiation/tetration/. |
|
I seem to remember a few years back someone (Stefan?) posted some
clever recursive macros here which would perform compile-time
calculations of exponentiation and possibly even tetration.
Google isn't being at all helpful - did anyone keep a copy?
I'd appreciate a repost.
I do remember trying to get a feeling for how they worked
when they were posted, and I thought that I did. Alas, years
later when I'd like to use something very similar, I've lost
all recollection of what made them work (more importantly,
what made them stop!).
I suspect the same, or similar, techniques are used here:
http://chaos-pp.cvs.sourceforge.net/chaos-pp/order-pp/example/bottles.c?revision=1.10&view=markup
but alas I'd call that and its #included brethren, a hideous
wall of noise, unlike the relatively simple example that was
posted here.
Cheers,
Phil
--
The best part of re-inventing the wheel is that you get to pick how
many sides the new one has. -- egcagrac0 on SoylentNews
|