Math exponent in C language.

Discussion in 'Programmer's Corner' started by Lilian23, Oct 29, 2008.

  1. Lilian23

    Thread Starter Member

    Oct 7, 2008
    12
    0
    Hi!

    How would you write this in C?

    y = -8E-11x^5

    I am aware of the pow() function but that takes things like 4^5, 2^3, etc. What about a very small number like that to the fifth power? Is there something for "E"? my compiler does not like it if I put -.00000000008

    thanks
     
  2. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    The length of the number you put depends if it is unsigned or singed and if you define it as short, long, longlong or floating.

    As, i understood you are talking about PIC uC programming so check its C reference manual here on page 198:

    http://www.ccsinfo.com/downloads/CReferenceManual.pdf
     
  3. mnwcsult

    New Member

    Oct 29, 2008
    1
    0
    You are correct about pow(),

    y = pow(-8.0E-11, 5.0);

    FYI, you really should have just looked this up.
     
  4. chuka_709

    New Member

    Nov 2, 2008
    1
    0
    Hi all,
    a0=a1=1; ai=a(i-2)+a(i-1)/pow(2,i-1); i=2,3,... so
    a0*a1*...*a14=?
    how would you write this in C?

    Plz help me and Thx
     
Loading...