These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Multiplication Rounding Up

Brunoboy
Registered: Nov 28 2008
Posts: 27

Hi,

Please help. I have spent countless hours searching in the Acrobat forums and blogs but I cannot find the answer to my multiplication problem.

I am trying to multiply two fields but the result always produce a figure that is rounded up, which I do not want. I want the actual result to show in the field without the rounding up of the figure.

Ex.: $305.56 x 36 is $11,000.16 but the result in the field shows $11,000.00

Can someone help me please?

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Are you using any other JavaScirpt' s to populate this field, format, or validate this field?

Are you using the JavaScript 'math.Round()' method anywhere?

George Kaiser

Freelancer
Registered: May 26 2009
Posts: 71
Brunoboy wrote:
Hi,Please help. I have spent countless hours searching in the Acrobat forums and blogs but I cannot find the answer to my multiplication problem.

I am trying to multiply two fields but the result always produce a figure that is rounded up, which I do not want. I want the actual result to show in the field without the rounding up of the figure.

Ex.: $305.56 x 36 is $11,000.16 but the result in the field shows $11,000.00

Can someone help me please?
Seems that if you multiply float with integer the result is integer...
This should not be that way. It should be:
If both expressions are integers, the product is an integer.
If either or both expressions are floating-point numbers,
the product is a floating-point number.
livedocs.adobe.com

Try this: 305.56 x 36.00 What da ya get?

Freelancer

P.S. What is needed to get that AUC Expert logo?

According to most IT HelpDesk people, the most common reason for user error (regardless of Operating System) is ID 10T.

Brunoboy
Registered: Nov 28 2008
Posts: 27
Hi Freelancer,

Thank you for replying. Actually, I think you may have stumbled on something that may be causing the problem.

Here is the calculation (and what I just discovered in the background):

To start, the result of the $305.56 comes from the addition of two amounts divided by 36:

$ 9,800.00 + $ 1,200.00 / 36 = $305.56 (which shows $305.555555 in the background)

This same amount of $305.56 ($305.55555) is automatically input in another field but shows as $305.555556 in the background)

So now, when the $305.56 (from the other field showing as $305.555556) is multiplied by 36, the result is:

$ 305.56 * 36 = $11,000.00 (which shows $11,000.0000 when it should actually be $11,000.16


I hope the above makes sense. It seems that the problem stars with the first equation where the addition of the two amounts divided by 36. There are too many decimals in the background and if the number of decimals could be limited to two decimals, perhaps it would resolve the problem.

What do I have to do to limit the number of decimals to two decimals in the first calculation where the division is made?

Thank you again for your help.

Bruno
Freelancer
Registered: May 26 2009
Posts: 71
Hi Bruno,

multiply with 100, round and divide by 100...
somthing like this: x = (Math.round (y*100))/100

check this and do some google with "javascript calculation error"
http://www.planetpdf.com/forumarchive/32094.asp
It seems that the problem is in javascript math engine...

Long, long time ago one math co-pro makes similar errors,
but only with certain m-board chipset.
O merde, we have that time a lot of probs with computers.

Freelancer

According to most IT HelpDesk people, the most common reason for user error (regardless of Operating System) is ID 10T.