1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Pow function in C

  1. Oct 15, 2004 #1
    How do you use the pow function from math.h?
    Here's how I've been using it and the compiler gives me trouble:
    month_pay = price*i*pow(1.0 + i, (double)n);

    This is the way it was written on the handout from our professor but he makes a lot of typos, so I want to make sure if this is the right way to use pow or not.
     
  2. jcsd
  3. Oct 15, 2004 #2

    Tide

    User Avatar
    Science Advisor
    Homework Helper

    It shouldn't take more than a minute or two to run a short test program through your compiler to find out!

    You should have no problem demonstrating that pow(a, b) is equivalent to a^b.
     
  4. Oct 15, 2004 #3
    well, if you are using gcc I believe you must use the -lm option when compiling....AND include math.h

    so you must do:
    gcc -lm filename.c
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Pow function in C
  1. Pressure= c (Replies: 2)

Loading...