• Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
    Dedicated community for Japanese speakers
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
    Dedicated community for Korean speakers
Exit
0

Turn off rounding and only show two decimal points

New Here ,
Oct 03, 2019 Oct 03, 2019

Copy link to clipboard

Copied

Hi,

Is there a script that will turn off rounding and only show two decimal points?  Iā€™m working on a worksheet that calculates a student GPA , and I need it to truncate after the second decimal point.  For example, instead of 3.236 rounding to 3.24, I need it to show as 3.23.

 

Thank you.

Views

2.4K

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 ,
Oct 03, 2019 Oct 03, 2019

Copy link to clipboard

Copied

Acrobat/Reader stores the results of calculations in 16 digit floating point numbers but calculates using binary numbers. This results in having a slightly different answer than when the computation is done with paper and pencil. Remove all formatting from the result field and observe the resulting value.  Also the displayed value as set by the Format tab is the rounded value of the results of the computation. If one uses the custom calculation script then one can force the result of the calculation using the Math.ceil  or the Math.floor  methods  to remove any rounding or use the util.printf method to round the result to an given number of decimal places. One can also create their own rounding script.

 

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 ,
Oct 04, 2019 Oct 04, 2019

Copy link to clipboard

Copied

Thank you for your assistance.

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 Beginner ,
Jan 16, 2024 Jan 16, 2024

Copy link to clipboard

Copied

LATEST

How do I use this script with the below?

I need for 2 decimals places to show with no rounding. 

EX: the total is 73.449, right now it's rounding to 73.45. I want it just to show 73.44. 

 

 

 

// Get first field value

var v1 = getField("Payroll6").value;


// Get second field value

var v2 = getField("Payroll7").value;


// Set this field value equal to the difference

event.value = (v1 * v2);

 

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