Home > front end >  Vue: used in the summary - method="getSummaries summarize the decimal point
Vue: used in the summary - method="getSummaries summarize the decimal point

Time:10-07

If only the show - the summary, automatically collect all columns, but some unit price column is not to need to summary, so you want to use the summary - method method, decimal problems at this time, the first data is 222, second data is 1000.7025, a summary was 1222.7024999999999, see the link

https://codepen.io/tyronehank/pen/povPeWe

Excuse me how can I let sums keep four decimal places

CodePudding user response:

Decimal addition and subtraction are error, the computer in binary calculation, in the case of and decimal conversion will there be an infinite loop, if your data is all four decimal places, the calculation of all can be multiplied by 10000, the first summary and then divided by 10000, this is only suitable for addition and subtraction
  • Related