Results 1 to 5 of 5

Thread: [RESOLVED] Feeling like an idiot now..

  1. #1

    Thread Starter
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    Resolved [RESOLVED] Feeling like an idiot now..

    How would I say " x to the yth power" in C#?

    x^y isn't doing it...
    ===================================================
    If your question has been answered, mark the thread as [RESOLVED]

  2. #2
    Registered User nmadd's Avatar
    Join Date
    Jun 2007
    Location
    U.S.A.
    Posts
    1,676

    Re: Feeling like an idiot now..

    You can use
    Code:
    Math.Pow(x, y)
    http://msdn2.microsoft.com/en-us/lib....math.pow.aspx

    ^ is the exclusive-or operator in C#.

  3. #3

    Thread Starter
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    Re: Feeling like an idiot now..

    I have this line of code:

    FVal = (Payment / APR2) * (1 - Math.Pow((1 + APR2), -TotPmts));

    All the variables are defined as single.

    I get this error:

    Error 1 Cannot implicitly convert type 'double' to 'float'. An explicit conversion exists (are you missing a cast?) I:\VB NET Source Code\C#\TVAL\TVAL\TVAL\Form1.cs 1248 20 TVAL
    ===================================================
    If your question has been answered, mark the thread as [RESOLVED]

  4. #4
    Registered User nmadd's Avatar
    Join Date
    Jun 2007
    Location
    U.S.A.
    Posts
    1,676

    Re: Feeling like an idiot now..

    Not exactly sure what data types you should be using but for this you can try changing your FVal variable to a double. Check this out too:
    http://msdn2.microsoft.com/en-us/lib...za(VS.80).aspx

  5. #5

    Thread Starter
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    Re: Feeling like an idiot now..

    That did it. Thanks again.
    ===================================================
    If your question has been answered, mark the thread as [RESOLVED]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width