none
Source code for power function RRS feed

  • Question

  • I am looking for the actual source code for a pow() function not source code that implements the pow function. This can be of any C++ library.
    • Moved by Wesley Yao Tuesday, March 16, 2010 3:43 AM algorithm question (From:Visual C++ General)
    Wednesday, March 10, 2010 9:01 AM

All replies

  • Did you try right click, go to implementation?

    Also read this article, it might apply to you http://www.codeproject.com/KB/debug/powproblem.aspx

    Whiter than the white is UV bright!
    Wednesday, March 10, 2010 9:25 AM
  • Visual Studio 2008 only has "Go to Definition" and "Go to Declaration" when using the pow() <cmath> Visual Studio Displays a dialog box stating that pow() is not declared and pow is not defined, respectively. For .NET System::Math::Pow() Visual Studio does nothing.
    Wednesday, March 10, 2010 4:41 PM
  • Thanks for the link, but it doesn't take a rocket scientist to raise one number to an unsigned integer. Hower raising a number to a signed decimal number is another ball game!
    Wednesday, March 10, 2010 4:44 PM
  • >I am looking for the actual source code for
    >a pow() function not source code that
    >implements the pow function.

    What's the difference? The "actual source code
    for a pow() function" "implements the pow
    function", doesn't it?

    Have you read this thread?

    http://www.gidforums.com/t-12889.html

    - Wayne
    Wednesday, March 10, 2010 5:07 PM
  • Maybe he needs it to do his school assignmnet.
    Ali
    Wednesday, March 10, 2010 7:21 PM
  • Thanks for the link, but it doesn't take a rocket scientist to raise one number to an unsigned integer. Hower raising a number to a signed decimal number is another ball game!

    Why is that a different ball game?
    Ali
    Wednesday, March 10, 2010 7:23 PM
  • Because you are working with real numbers and computers suck with them. This is elementary school math and computer basics. Not an easy task but solvable with special classes.
    Whiter than the white is UV bright!
    Wednesday, March 10, 2010 8:03 PM
  • What's the difference? The "actual source code
    for a pow() function" "implements the pow
    function", doesn't it?
    True it does. But what I meant is that when I did searches for the source code for a pow() function all I got was source code that called the pow() function of whatever library, rather than the declaration (or implementation) of the pow() function.
    Friday, March 12, 2010 8:56 AM
  • >Why is that a different ball game?

    Raising one number to a another number is defined as repeated multiplucation. For instance 5 raised to 2 is equal to 5 x 5; and 5 raised to 3 is 5 x 5 x 5. Unfortunately this same rule does not apply when working with decimals. For instance how do you define 5 raised to 0.25. There are two ways (as far as I know) if you wan't to know how check out DR.Math's website.
    Friday, March 12, 2010 9:04 AM
  • I have defined a special class.  That is why I am looking for a pow() function so that I can learn how to implement my own.
    Friday, March 12, 2010 9:07 AM
  • >Why is that a different ball game?

    Raising one number to a another number is defined as repeated multiplucation. For instance 5 raised to 2 is equal to 5 x 5; and 5 raised to 3 is 5 x 5 x 5. Unfortunately this same rule does not apply when working with decimals. For instance how do you define 5 raised to 0.25. There are two ways (as far as I know) if you wan't to know how check out DR.Math's website.

    I miss read your post. I thought you meant 5.23 to the power of 2.

    That is interesting, I have really never thought about how that is calculated.
    Ali
    Wednesday, March 17, 2010 4:58 AM