Calc Builder Support

Calc Builder support
No se permite escribir sin estar logado. Por favor, login

decimal points and calculation error 13.03.2013 15:35


I built a form, and added the decimal points in php as the commas and dec points weren't rendered even though I added in preferences.

I do have joomla 1.5 version. My calculations do else work fine, but not the last one:







Frontend result:

result_1 ok
result_2 ok
result_3 ok
ratio ok
result wrong


Anybody out there who can tell me what I did wrong?

Thank you in advance

Kind regards


Re: decimal points and calculation error 13.03.2013 15:54


You´re trying to add $result_1 and $result_2 and so on to get $result. The problem is that $result_1 is a String, not a number. You should save $result_1 as number before applying number_format function and then use it.

Code looks like this:





Hope this helps.
Moonsoft Team

Re: decimal points and calculation error 18.03.2013 09:24

Thank you so much for helping! It's still not working right, unfortunately.
shouldnt that as well define the variables as numbers: $result_1=number_format($result_1,2,',','.');?

I know that if you try the calculation with 200 employees and 135 wage you finally should retrieve following numbers:


(1,2 % af den årlige lønomkostning)
Omkostninger: 499.500,00 kr. pr. anno
-> should be: 600.000,00

TOTAL= 108.054,00
-> should be: 763.620,00

Re: decimal points and calculation error 19.03.2013 12:08


Number format is not used to define variables as numbers, but to format them. So, you only have to perform all calculations without using number_format function and once all results are calculated execute number_format function as the last lines of your calculators.

Moonsoft Team

Re: decimal points and calculation error 19.03.2013 14:36

Now I figured it out!

Thank you sooo much indeed

Cheers from Denmark to lovely Spain

Are you satisfied with our products/services/support?
Please help us to keep improving, add a review at  joomla extensions site and  magento connect
FaLang translation system by Faboba

Lo que nuestros clientes opinan de nosotros