WordPress.org

Support

Support » Plugins and Hacks » Calculated Fields Form » [Resolved] Can't make mathematical form work

[Resolved] Can't make mathematical form work

  • Hi.

    I am having a problem with making my mathematical formula “work”.

    I am making a formula of a simple future value calculation.

    The formula is: Present value * (1 + interest/100)^number of time periods.

    I have entered this formula in my calculated field:
    PREC(POW(fieldname4*(1+fieldname2/100),fieldname3),2)

    Fieldname 4 is present value
    Fieldname 2 is interest
    Fieldname 3 is number of time periods

    If i for example enter 100 in present value, 2 in interest, and 20 in time periods i get a huge number compared to the real answer which should be 148.59

    https://wordpress.org/plugins/calculated-fields-form/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author codepeople

    @codepeople

    Hi,

    Please, replaces the fields names, by the initial numbers in your current equation:

    If the present value is 100, and the interes is 2, and the number of time periods is 20, your equation would be:

    PREC(POW(100*(1+2/100),20),2) = PREC(POW(102,20),2)

    and

    102^20 = 1.4859473959783544e+40

    PREC(POW(1.4859473959783544e+40),2) = 1.4859473959783544e+40

    So, if you’re obtaining a huge number as equation’s result with the initial values you sent me, the equation is working fine.

    Now, if you modify the equation like follow:

    PREC(fieldname4*POW((1+fieldname2/100),fieldname3),2)

    you will get the result you want 😉

    Remember, you should create the equations maintaining the priorities between the operations of the Mathematical world.

    Best regards.

    Thanks 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Can't make mathematical form work’ is closed to new replies.
Skip to toolbar