0

I'm developing a small application in Deluge (zoho.com). There isn't a "^" operator or a "pow" function to do exponentiation. Getting worst, I'm supposed to do exponentiations also with float exponents, instead just integer exponents. I've found a lot of algorithms doing integer exponentiations, but none that do it for float ones. Thank you for helping.

Alex
  • 3,325
  • 11
  • 52
  • 80

1 Answers1

1

They are basically same. If you want something simple, then repeatedly multiplying would do. If you want to make the multiplication process efficient, you can go for Divide and conquer algorithm,

Shamim Hafiz - MSFT
  • 21,454
  • 43
  • 116
  • 176
  • I must to implement a function that would do an exponentiation either of a integer base and exponent and a float base and exponent. The integer algorithm couldn't do it: – Alex Dec 13 '10 at 17:50
  • float math.potencia(float base, int expoente) { //retorno = 1.1; if(expoente>0) { base = base * thisapp.math.potencia(base, (input.expoente - 1)); } else if (expoente == 0) { base = 1; } return base; } – Alex Dec 13 '10 at 18:08