Answer the question
In order to leave comments, you need to log in
How to raise decimal to floating point power?
Given the number 1.000001, when raised to a power of 2**19, we get
result: 1.6892552271606103
There is a custom function that does the same thing, but a different result comes out.
1.000001**2**19
function costumePow(num, pow) {
for(let i = 0; i < pow; i++)
{
num *= num;
}
return num;
}
Answer the question
In order to leave comments, you need to log in
You messed something up.
1.000001**2**19 also returns 1.689255227180379. Just checked in console.
> costumePow(1.000001, 19)
1.689255227180379
> 1.000001**2**19
1.689255227180379
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question