If you have large (positive or negative) exponents, the following
function is faster and more stable. (Not copyrighted either :-):

double pow( double base, Int16 ex ) {
  double res = 1.0;
  double fak = base;

  if( ex>=0 ) {
    while( ex ) {
      if( ex%2 ) res *= fak;
      fak *= fak;
      ex >>= 1;
    }
  } else {
    ex = -ex;
    while( ex ) {
      if( ex%2 ) res /= fak;
      fak *= fak;
      ex >>= 1;
    }
  }
  return res;
}
  
Regards,
Mit freundlichem Gru�,
        Holger Klawitter
--
Holger Klawitter                                    +49 (0)251 484 0637
[EMAIL PROTECTED]                            http://www.klawitter.de/



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to