Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. Article Writing
  4. How to implement double pow(double x , double y)

How to implement double pow(double x , double y)

Scheduled Pinned Locked Moved Article Writing
tutorial
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    ctrl alt del
    wrote on last edited by
    #1

    I have to impelement my own double pow(double x , double y) I cannot use of math library any ideas Ctrl+Alt+Del

    N R 2 Replies Last reply
    0
    • C ctrl alt del

      I have to impelement my own double pow(double x , double y) I cannot use of math library any ideas Ctrl+Alt+Del

      N Offline
      N Offline
      Nik Vogiatzis
      wrote on last edited by
      #2

      it helps if you understand what POWER means... in primary school, we learnt that 2^5 = 2*2*2*2*2 so x^y = x1*x2*x3*x4*...*xj where j=y you don't need any maths libraries... i hope this helps with you homework... Nik Vogiatzis PhD Candidate: University of South Australia +++++++++++++++++++++++++++ Developing new generation Traffic Micro-simulation Tools for Traffic Engineers em: nikolaos.vogiatzis@unisa.edu.au

      J R 2 Replies Last reply
      0
      • N Nik Vogiatzis

        it helps if you understand what POWER means... in primary school, we learnt that 2^5 = 2*2*2*2*2 so x^y = x1*x2*x3*x4*...*xj where j=y you don't need any maths libraries... i hope this helps with you homework... Nik Vogiatzis PhD Candidate: University of South Australia +++++++++++++++++++++++++++ Developing new generation Traffic Micro-simulation Tools for Traffic Engineers em: nikolaos.vogiatzis@unisa.edu.au

        J Offline
        J Offline
        Janovetz
        wrote on last edited by
        #3

        In high school, we learned that you can raise numbers to non-integer powers. Although your 'algorithm' would be applicable if the request was for double pow(double x, int y), things become more complicated for double y, typically involving logarithms.

        N 1 Reply Last reply
        0
        • J Janovetz

          In high school, we learned that you can raise numbers to non-integer powers. Although your 'algorithm' would be applicable if the request was for double pow(double x, int y), things become more complicated for double y, typically involving logarithms.

          N Offline
          N Offline
          Nik Vogiatzis
          wrote on last edited by
          #4

          yup... sounds reasonable... it's been a VERY long time since i was at either primary school or high school, but your response sounds reasonable... either way, this sounds like a 'homework' question, and i think our friend needs to do their homework by looking up the alorithms either on the net, or in their maths book... cheers nik Nik Vogiatzis PhD Candidate: University of South Australia +++++++++++++++++++++++++++ Developing new generation Traffic Micro-simulation Tools for Traffic Engineers em: nikolaos.vogiatzis@unisa.edu.au

          1 Reply Last reply
          0
          • N Nik Vogiatzis

            it helps if you understand what POWER means... in primary school, we learnt that 2^5 = 2*2*2*2*2 so x^y = x1*x2*x3*x4*...*xj where j=y you don't need any maths libraries... i hope this helps with you homework... Nik Vogiatzis PhD Candidate: University of South Australia +++++++++++++++++++++++++++ Developing new generation Traffic Micro-simulation Tools for Traffic Engineers em: nikolaos.vogiatzis@unisa.edu.au

            R Offline
            R Offline
            Ruchi Gupta
            wrote on last edited by
            #5

            Mr. Nik, How with your primary school maths, can you calculate Pow(1.5, 2.3) I myself don't know the answer. But I would give a friendly advice - Give a thought before commeting and telling what is taught in primary schools. Thanks Ruchi

            N 1 Reply Last reply
            0
            • C ctrl alt del

              I have to impelement my own double pow(double x , double y) I cannot use of math library any ideas Ctrl+Alt+Del

              R Offline
              R Offline
              Ruchi Gupta
              wrote on last edited by
              #6

              public double Pow(double a, double b) { double temp = 0, final = 0; temp = b*Math.Log(a); final = Math.Exp(temp); return final; } Hope this helps Thanks Ruchi

              1 Reply Last reply
              0
              • R Ruchi Gupta

                Mr. Nik, How with your primary school maths, can you calculate Pow(1.5, 2.3) I myself don't know the answer. But I would give a friendly advice - Give a thought before commeting and telling what is taught in primary schools. Thanks Ruchi

                N Offline
                N Offline
                Nik Vogiatzis
                wrote on last edited by
                #7

                ruchi, if you had read my previous response to janovetz, you would have realised i had already conceded that point... i would also like to provide some friendly advice... read *all* the thread before providing friendly advice... cheers nik Nik Vogiatzis PhD Candidate: University of South Australia +++++++++++++++++++++++++++ Developing new generation Traffic Micro-simulation Tools for Traffic Engineers em: nikolaos.vogiatzis@unisa.edu.au

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups