I have an app that getting Ethereum balance by address. The app receives balance from API and then puts it to the database. Balance comes in hex-integer:
$balance = $response->getBody(); //0x1e1e83d93bb6ebb88bbaf
Then I convert it to the WEI integer:
$hexInt = BC::hexdec($balance); // WEI "2275742359981542120930223"
And then I need to Convert WEI to ETH:
return $balance / '1000000000000000000';
If calculate it, it will be 2275742.359981542120930223
, but PHP converts it to 2275742.3599815
. As you see, php rounds this number after division. Why? And how can I get right result?