Author Topic: [Possible bug] Excel formula sum doesn't work as expected (V 4.0.1)  (Read 1516 times)

bruno.anjos

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 4
    • View Profile
Hello.

I'm using the sum excel formula for my summary row like this:

summaryData: [{ classe_comp:'Soma', summaryRow: true, pq_fn:{n_nao_determinados:'sum(C:C)', n_machos:'sum(D:D)', n_femeas:'sum(E:E)', n_indiferenciados:'sum(F:F)', peso_nao_determinados:'sum(G:G)', peso_machos:'sum(H:H)', peso_femeas:'sum(I:I)', peso_indiferenciados:'sum(J:J)',  }}],

However I've noticed that when I input certain numbers in the grid the sum goes crazy and instead gives me an approximate number (either above or below). I'll attached a printscreen showing the issue.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: [Possible bug] Excel formula sum doesn't work as expected (V 4.0.1)
« Reply #1 on: October 09, 2018, 10:05:44 pm »
That's an issue with the javascript calculations.

https://stackoverflow.com/questions/1458633/how-to-deal-with-floating-point-number-precision-in-javascript

To fix it, you can use column.format to round off the decimals.