Or to put it another way, one or more of the values in F6, G29 and L29 in Excel is slightly more than it appears to be when rounded or truncated for display purposes.
MySQL, Excel, and Windows Calculator show different results for same expression
-
30-08-2022 - |
Question
I am rounding a number to 4 decimal places. I am trying to copy an Excel calculation but seeing a different result in MySQL.
Excel formula: =($F$6/100)*G29*L29
where $F$6 = 5, G29 = 59.23 and L29 = 58.3
On Excel I get 172.6576
On a Windows Calculator I get 172.65545
Using MySQL I get 172.6555
Following in a for loop:
SELECT ID, lookupprocess.PROJID, PRICE, SUM(abs( FSP-LSP)) AS ABS, SUM(((abs( FSP-LSP))*SI)/1000) AS KM_Completed, count(lookupprocess_id) AS NoOfLines, (".$countcompleted[0]['count']."/$countJobs)*100 AS TotalPercent, SUM(((abs( FSP-LSP))*SI)/1000) * PRICE AS TotalPrice
FROM hdb.lookupprocess
left join jobsprocesscomplete on ID = lookupprocess_id
left join detailsseismic on jobsprocesscomplete.JOBNO = detailsseismic.JOBNO
left join biditems on biditems_id = ITEMID
where lookupprocess.PROJID = ".$model->PROJID."
AND ID = $k
Do PHP and JavaScript comply with Excel formulas/calculations?
La solution
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow