0
I’m having trouble making an exact calculation in PHP, note.
$selic = 0,96;
$ipca = 0,42;
bcscale(10);
$sub = bcsub($selic, $ipca); //Retona: 0.54000000
// ou
$sub = $selic - $ipca; //Retorna: 0.54
The exact result for this formula no Excel
is: 0,54316901573592300
That goes for subtraction, addition, division and multiplication, someone can help me?
Editing
It was bad there, the error is in Excel, not with PHP. I’m not even a little used to it. But thank you all.
The problem is in the
$selic
and in the$ipca
, Holy balls,0.96 - 0.46
of exactly0.54
– MarceloBoni
look friend 0,96 - 0,42 = 0,54 your formula in excel must be wrong
– SneepS NinjA
See in your excel file, that the value of ipca and Selic is not exactly these, extend the squares after the comma :)
– MarceloBoni
I’m going to take this dynamic data from uam API, and this api only returns 2 homes after the comma
– Alex
There’s nothing to do, unfortunately
– MarceloBoni
$selic = 0.96013899947120500
.$ipca = 0.41696998373528200
. result of subtraction:0.54316901573592300
. Now0.96 - 0.46 = 0.54
– MarceloBoni
So my problem will be with the API or with EXCEL? Which one should I trust?
– Alex
Or look for a Ws that tells the value with more decimals, if you want to beat excel with the result in your calculation
– MarceloBoni
Ixi, now where I’m gonna find a central bank WS, this one I got from
portal de dados abertos do brasil
– Alex
@bfavaretto The boy’s excel: https://onedrive.live.com/edit.aspx?cid=998af8ca813c01c8&page=view&resid=998AF8CA813C01C8! 176&parId=998AF8CA813C01C8! 175&authkey=! Aa3v8eddxxifbzo&app=Excel
– MarceloBoni