Discussions

Expand all | Collapse all

Math.pow()

  • 1.  Math.pow()

    Posted 08-06-2018 16:36
    I am trying to recreate a loan calculator I had originally created in javascript. The problem is I cannot find a workaround for the Math.pow() method. I would like to do this without IOL and stick to QuickBase formulas 

    const principal = parseFloat(amount.value)
    const calculatedInterest = parseFloat(interest.value) / 100 / 12
    const calculatedPayments = parseFloat(years.value) * 12

    // Compute monthly payment
    const x = Math.pow(1 + calculatedInterest, calculatedPayments)
    const monthly = (principal * x * calculatedInterest) / (x - 1)

    if (isFinite(monthly)) {
    monthlyPayment.value = monthly.toFixed(2)
    totalPayment.value = (monthly * calculatedPayments).toFixed(2)
    totalInterest.value = ((monthly * calculatedPayments) - principal).toFixed(2)

    //Show Results
    document.getElementById('results').style.display = 'block'

    //Hide Spinner
    document.getElementById('loading').style.display = 'none'
    } else {
    showError('Please Check Your Numbers')

    }


  • 2.  RE: Math.pow()

    Posted 08-06-2018 16:39
    what does math.pow do?

    There is a native exponent function in Quick Base

     for example

    10^2 = 100

    ^ means "to the power of"



  • 3.  RE: Math.pow()

    Posted 08-06-2018 16:52
    Ha, that simple! thank you