Quantcast
Channel: Adobe Community : Popular Discussions - JavaScript
Viewing all articles
Browse latest Browse all 12130

using script to get percentage values and not able to sum upto 100%

$
0
0

Hello All 

 

I am trying to use a parseFloat() function to convert string to percentage value and then trying to add all of the % values.

 

but for few scenrios even if the sum is 100%, from the function i get the PctValue either < or > 100.00%

 

function doing the calculation is as follows -

 

code -

iterating_through_all_the_fields {

 

     PctValue += parseFloat(this.getField("Percentage1").valueAsString);

 

}

 

sample -

11.12

11.11

11.11

11.11

11.11

11.11

11.11

11.11

11.11

 

expected sum is 100

 

but through above mentioned code i get back 99.99

 

Any help is appreciated in this regard.


Viewing all articles
Browse latest Browse all 12130

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>