
1. Re: Rounding
MichaelN Sep 3, 2013 8:24 PM (in response to Jamie_deven)Use JavaScript's Math.round method to round numbers to the nearest whole number.
Assuming you have 2 text fields called "Result" and "PROJECTED_OCCUPIED_NIGHTS", you can use the following script as the custom calculation script for "Result":
var n = getField("PROJECTED_OCCUPIED_NIGHTS").value;
if (n !== ""){
var r = Math.round(n*0.05);
this.getField("Result").value = r;
}
else getField("Result").value = "";
You can read more about Math.round here:
http://forums.adobe.com/message/2255902#2255902
and here:

2. Re: Rounding
George_Johnson Sep 3, 2013 11:01 PM (in response to MichaelN)1 person found this helpfulThose last two lines should be:
event.value = r;
}
else event.value = "";

3. Re: Rounding
gkaiseril Sep 4, 2013 8:01 AM (in response to MichaelN)You might find http://www.acrotex.net/data/edu/rounding.pdf helpful in writing a rounding function. There is known issue with the Math.round method for floating point numbers. It works best for numbers with only 1 decimal.
http://stackoverflow.com/questions/588004/isjavascriptsfloatingpointmathbroken

4. Re: Rounding
Jamie_deven Sep 5, 2013 6:25 AM (in response to MichaelN)Thank you for the help.. I will review the link this weekend.

5. Re: Rounding
Jamie_deven Sep 5, 2013 6:28 AM (in response to gkaiseril)Thank you for the help.. I will review the link this weekend.

6. Re: Rounding
Jamie_deven Sep 5, 2013 6:29 AM (in response to George_Johnson)Thank you for the help.