Get Free Trial
Get Free Trial

Rounding issue and data parsing

Answered
Artem asked on October 22, 2019

Hi,
I have two questions:

  1. In the dataset I’m using there is a column with floating point numbers(attached). When Grand Total is summed up for this column, it’s 12102.00000000002, though it should be 12102. It looks like it’s JS floating-point arithmetic issue rather than FlexMonster one, but do you plan to apply some fixes for it?
  2. Numbers in the dataset are used with dollar signs. As I understand FlexMonster did some parsing to be able to understand that this is a number, not a string. Is there any description of how it’s parsed in documentation? And does it make sense(performance-wise) to parse it on my side instead of passing it this way?

Thanks in advance

2 answers

Public
Vera Didenko Flexmonster October 23, 2019

Hello, Artem,
 
Thank you for writing to us.
 
Please see our answers below: 
 
1) We would like to confirm that it is a JS floating-point arithmetic issue.
Our development team will continue to research it. We will keep you updated.
 
In the meantime, we kindly suggest using the maxDecimalPlaces parameter to limit the number of digits after the floating-point. 
Please see the following JSFiddle example for illustration: https://jsfiddle.net/flexmonster/s5w2460v/
 
2) About parsing:
The result of data parsing for numbers included in quotes may differ depending on the used browser and user locale.
We strongly recommend passing raw data to Flexmonster and configuring the formatting (for example, the currency symbol) in the report object.
Please see our number formatting tutorial for guidance: https://www.flexmonster.com/doc/number-formatting/#!currency
This approach is also illustrated in the provided JSFiddle example: https://jsfiddle.net/flexmonster/s5w2460v/
 
 
Please let us know if you have any questions.
 
Best Regards, 
Vera

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster November 5, 2019

Hello, Artem,
 
We are happy to let you know that the issue with beautifying numbers with a floating point was fixed.
 
This is available in the 2.7.18 version of Flexmonster: https://www.flexmonster.com/release-notes/
 
You are welcome to update the component.
Here is our updating to the latest version guide for assistance: https://www.flexmonster.com/doc/updating-to-the-latest-version/ 
 
Please let us know if everything works fine for you.
 
Best Regards,
Illia

Please login or Register to Submit Answer