Calculation working incorrectly

Hello,

 

The calculations seems to be messed up. It doesn’t give the correct results.

For example, when I create one hidden field (field’s ID=100 for example) with a value of “1.6″

And then I create another field where I “Calculate the default value for this field”, using this formula for example:

[100]*180*1.7

 

where [100] is the ID of the hidden field.

And when I preview the form, it gives me a weird result for the calculated field. The result it gives is “489.59999999999997″

But when I try to use any calculator, the result should be exactly “489,6″

1,6*180*1,7=489,6

Any idea why it gives me the weird incorrect result?

If you add ").toFixed(1" to the end of your calculation you should get 489.6 as the result. So your calculation would become: [100]*180*1.7).toFixed(1

My guess is that your calculator is rounding since the .59999999999999997 is so close to .6

Thanks but no matter what calculator I try, it always gives me exactly 489,6 for the result.

How to explain that the Formidable field calculation differs from all other calculators? :(

I also tried to calculate by hand (manually with a piece of paper and a pencil) doing the simple math which also gives me exactly 489,6 for the result.

 

 

Hmm, interesting. We use PHP calculations to do the math. I am not sure why a simple equation like this would be any different from any other calculator, did you try that rounding option I gave you?

We'll look into the script that runs the calculations one more time.

Topic closed.