Post
Topic
Board Bitcoin Technical Support
Topic OP
Why is this code yielding something like this?
by
CounterEntropy
on 18/06/2022, 17:20:47 UTC
I am using the following PHP code...

Code:
echo round(($satoshiValue/pow(10,8)),8);

When, $satoshiValue = 10000, result is 0.0001 as expected.

But, when, $satoshiValue = 10000000, result is 0.10000000000000001. Expected was 0.1 though.

Why is this happening?


p.s. I could not find a better place to ask this question on BitcoinTalk. So, asking it here. If mods think, it does not fit here, feel free to move.