# Computing the exact exponentiation of a fractional base

not the same solution as this

In a function, I need to calculate the exponential of a fraction. The exponent is a whole number, and the base is not.

I tried using the ABDKMath64x64 library and using this formula:

I converted r into a 64.64bit fixed float which is this: (1.8538977)×10^19÷2^64 ≈ 1.0049999569529399767731092651956714689731597900390625

(My r value is 0.005 or 0.5%)

And I got the majority of my code working here

``````    int128 nominator = 1.8538977 * 1e19;
nominator = ABDKMath64x64.log_2(nominator);
int128 newNominator = nominator * rebaseAmount;
int128 result = ABDKMath64x64.exp_2(newNominator);
uint64 uintResult = ABDKMath64x64.toUInt(result);
return uintResult;
``````

The problem is the last line. I am certain my int128 result is accurate (when I manually divide it by 2^64, I get my desired number), but when I cast it to a uint, it gives me a single whole number, which is like the current whole number, but rounded down to classic uint style.

Is there a way to cast the result into a uint whilst keeping the following decimals? I tried doing * 1e18 to the above code but the decimals don't keep due to the conversion.

If not, are there better ways at solving 1.005^x, than using this library and formula?

``````        nominator = ABDKMath64x64.log_2(nominator);