• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

rounding error

New Here ,
May 17, 2017 May 17, 2017

Copy link to clipboard

Copied

Please help!  Trying to beat a work deadline.  The rounding issue can clearly be seen if I can send someone the pdf

TOPICS
Create PDFs

Views

2.9K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , May 06, 2018 May 06, 2018

Acrobat and Excel behave in a very similar manner for this type of calculation.

Without any formatting or rounding 7 * 0.535 is displayed as 3.7450 the total of 5 iterations is 18.725.

Formatted to 2 decimal places the displayed value is 3.75 the total of 5 iterations is 18.73.

Individual result values rounded to 2 decimal places the displayed total is 3.75 the total of 5 iterations is 18.75.

When dealing with financial reports or government forms the result of each calculation should be rounded to

...

Votes

Translate

Translate
LEGEND ,
May 17, 2017 May 17, 2017

Copy link to clipboard

Copied

You might have to tell us a lot more about it...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 17, 2017 May 17, 2017

Copy link to clipboard

Copied

I have a formula that is miles times .535.  The answer is rounded to 2 decimal points.  I have 5 rows with this calculation

Then I have a total that is the the sum of the aforementioned rows.  That total is rounded to 2 decimal points.  Here is what my sheet looks like:

Miles     Mileage cost

7          $3.75

7          $3.75

7          $3.75

7          $3.75

7          $3.75

Total:

35     $18.73

It should read $18.75

Can you help?  Thanks so much!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 06, 2018 May 06, 2018

Copy link to clipboard

Copied

Result of 7 * 0.535 is 3.745    formatted as 3.75

Result of 5 * 3.745 is 18.725  formatted as 18.73

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 04, 2018 May 04, 2018

Copy link to clipboard

Copied

Make sure your formula has is "=round(mile*rate),2)"

For total use "sumproduct(FROM:TO)

Understand your existing total is more correct.

     

Miileage 0.535000
Error
7.0000003.74503.75-0.0050
7.0000003.74503.75-0.0050
7.0000003.74503.75-0.0050
7.0000003.74503.75-0.0050
7.0000003.74503.75-0.0050
18.725018.75-0.0250

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 05, 2018 May 05, 2018

Copy link to clipboard

Copied

What you are experiencing is the result of the "Format" setting that only changes the displayed value of a field and not the actual value of the field. If you increase the number of the decimal points in the formatting settings, you see a result in the displayed value.

"round" is not a function in JavaScript nor Adobe Acrobat JavaScript.

If this is a user written function can you please post the code and instructions on how to add it to a PDF.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 06, 2018 May 06, 2018

Copy link to clipboard

Copied

hermanw28045343  wrote

Make sure your formula has is "=round(mile*rate),2)"

For total use "sumproduct(FROM:TO)

...

Info: Adobe Acrobat and MS Excel are different products.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 06, 2018 May 06, 2018

Copy link to clipboard

Copied

Acrobat and Excel behave in a very similar manner for this type of calculation.

Without any formatting or rounding 7 * 0.535 is displayed as 3.7450 the total of 5 iterations is 18.725.

Formatted to 2 decimal places the displayed value is 3.75 the total of 5 iterations is 18.73.

Individual result values rounded to 2 decimal places the displayed total is 3.75 the total of 5 iterations is 18.75.

When dealing with financial reports or government forms the result of each calculation should be rounded to the required number of decimal places for the report or form.

Rounding Example in PDF and Excel

Since Acrobat does not include a rounding function, a user written rounding function has been added as a document level function to the PDF. This function was adapted form a PDF rounding examples developed by D.P. Story.

Most individuals when computing this type of problem subconsciously round the individual results to 2 decimal places, but computers do not.

RoundingExample.jpg

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 24, 2019 Sep 24, 2019

Copy link to clipboard

Copied

LATEST

Computers do the calculations using the binary number system, so as many are aware the decimal vlaues do not always convert to a rational value but result in an irrational value. The resulting values is stored as decimal floating point values. 

 

The Math.round method works only on intiger values or whole numbers. One can multiply by 100 use the Math.round method and divide the result by 100 and for most values come up with the correct result but not in all cases. It is possible to set the displayed value of a field to 2 decimal places, but this does not change the actual computed value. 

 

If one needs to round the actual value of the calculation to 2 decimal places then one needs to write a custom function to perform the rounding unless one wnats to repeat the code for rounding at every situation where the result needs to be rounded. 

 

The following document level function will decimal round a number to the power of 10 places. For 2 decimal places or 1/100 th one would use a value of -2 for the decimal level to. A sample file of rounding a value to 2 decimal places.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines