c - Algorithm for tetration to work with floating point numbers -


tetration level above exponentiation (e.g: 2^^4 = 2^(2^(2^2)) = 65536.

so far, i've figured out algorithm tetration works.

however, although variable a can floating or integer, unfortunately, variable b must integer number.

how can modify pseudo-code algorithm both a , b can floating point numbers , correct answer produced?

// hyperoperation type 4: public float tetrate(float a, float b) {     float total = a;     (i = 1; < b; i++) total = pow(a, total);     return total; } 

in attempt solve this, i've created own custom power() function (trying avoid roots, , log functions), , generalized multiplication. unfortunately, when try generalize tetration, numbers go pear shaped.

i algorithm precise x amount of decimal places, , not approximation wikipedia talks about. clarify, preferably, need satisfy @ least first three requirements, , fourth requirement can answerer.

base_num ^^ tetration_num =

e^( base_num * ln (e^(tetration_num * ln base_num)))

natural log can calculated taylor series whatever accuracy need.

e^x can calcuated whatever accuracy need taylor series.

with care over/underflow, should able work whatever values need using above.

just in case need series, this page lists ones need. having coded similiar in fixed point math (ints, no floats) can isn't hard , running, need careful order in things or overflow numbers quickly.


update

it turns out above works tetrations did not understand how tetrations work. silly rabbit.


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -