CryptoFly.us | CRYPTOCURRENCY BITCOIN SHIRTS CLOTHING APPAREL HATS

CRYPTO NEWS

Rand Paul Considers Crypto a Possible Reserve Currency

repeated exponential with decimal numbers

What’s an efficient way to do exponentials of numbers with decimals, such as when compounding interest rate calculations? For example: 1.001 ** 69 As of now, I naively implement it like this: uint mantissa = 1e3; uint rate = 1; uint periods = 69; uint out = mantissa; for(uint i=0; i < periods; i++){ out::Listen

What’s an efficient way to do exponentials of numbers with decimals, such as when compounding interest rate calculations?

For example: 1.001 ** 69

As of now, I naively implement it like this:

uint mantissa = 1e3; uint rate = 1; uint periods = 69; uint out = mantissa; for(uint i=0; i < periods; i++){   out = out * (mantissa + rate);   out = out / mantissa; } 

My worry is if the number of periods get big then I’m running a pretty inefficient loop. Anyone have any better ideas? Are there any libraries that do this implementation for me? Thanks!

Rand Paul Considers Crypto a Possible Reserve Currency

Shopping cart
There are no products in the cart!
Continue shopping
0