Thread: exponents

  1. #1
    Registered User
    Join Date
    Feb 2006
    Posts
    14

    exponents

    Can someone explain how to write this as an exponential value since i have NO clue at all?

    monPayment=(loanAmt*(monIntRate)/(1-(1-monIntRate) and then right here is the exponent -noMonths)

    How do I do it as an exponent for -noMonths? Something with Pow I know...but I cannot for the life of me figure it out!

    Thanks!

  2. #2
    aoeuhtns
    Join Date
    Jul 2005
    Posts
    581
    pow(x, y) computes x to the y'th power.
    There are 10 types of people in this world, those who cringed when reading the beginning of this sentence and those who salivated to how superior they are for understanding something as simple as binary.

  3. #3
    Registered User
    Join Date
    Feb 2006
    Posts
    14
    Okay, so wait...I would write it like this?

    pow( (loanAmt*(monIntRate)/(1-(1-monIntRate), -noMonths)

    Is that right?

  4. #4
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    Why don't you just calculate the term and its exponent on one line and use that result for the full calculation on another line?

    If a calculation is too complex for you, break it down. You could calculate the numerator on one line, then you could calculate the term with the exponent on another line, then you could calculate the full denominator on a third line, and then you could calculate the numerator over the denominator on a 4th line.
    Last edited by 7stud; 03-16-2006 at 10:24 PM.

  5. #5
    Registered User OnionKnight's Avatar
    Join Date
    Jan 2005
    Posts
    555
    Code:
    monPayment=(loanAmt*(monIntRate)/(1-pow((1-monIntRate), -noMonths))
    maybe?

  6. #6
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    you forgot a ')' on the end there
    Last edited by major_small; 03-16-2006 at 10:52 PM.
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  7. #7
    Registered User OnionKnight's Avatar
    Join Date
    Jan 2005
    Posts
    555
    Yeah I see that now but that's because it was like that originally and I just copypasted it so I will not take the blame for this

  8. #8
    Registered User
    Join Date
    Feb 2006
    Posts
    14
    Umm..yeah, the parenthesis were my fault. Looking at it again, I forgot one.

    Anyway, does that (with an extra parenthesis) work for an exponent? I'm going to try it that way!

    Thanks!

    You guys rock!!

  9. #9
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Make sure you include <cmath> when you're using pow().
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. exponents are LAAAME
    By Sm33zy in forum C Programming
    Replies: 8
    Last Post: 11-21-2008, 10:10 PM
  2. Fraction Exponents
    By ninjaturtle[k9] in forum C++ Programming
    Replies: 4
    Last Post: 10-18-2004, 10:46 AM
  3. God, i feel like a n00b again. How do i do exponents?
    By Inquirer in forum C++ Programming
    Replies: 13
    Last Post: 09-01-2003, 08:41 PM
  4. how to use exponents
    By guitargatler in forum C++ Programming
    Replies: 11
    Last Post: 02-01-2003, 09:09 PM
  5. For loop and exponents
    By TrazPFloyd in forum C++ Programming
    Replies: 5
    Last Post: 10-15-2002, 05:19 AM