as posted earlier:
>Try this one.
>Regards,
>Steve Mann
# # #
/*****************************************************
__sqrt
Calculate the square root of a double number.
*****************************************************/
double __sqrt ( double number ) {
double result = ZERO, square = ZERO, diff = ZERO;
UInt cnt = 0;
// eliminate negatives and zeros
if ( number <= ZERO ) result = ZERO;
else {
result = number; // initial approximation
// loop until required precision is attained or loop counts out
do {
result = ( result + number / result ) / TWO;
cnt++;
square = result * result; // only for
calculating termination
diff = square - number;
} while (( diff > ZERO ) && ( cnt < 30 )) ;
}
return result;
}
-------------------------------------------
Creative Digital Publishing Inc.
1317 Palm Street, San Luis Obispo, CA 93401-3117
-------------------------------------------
805.788.0138 805.593.3811 (fax)
[EMAIL PROTECTED] http://www.cdpubs.com
-----Original Message-----
From: Richard Lui <[EMAIL PROTECTED]>
To: Palm Developer Forum <[EMAIL PROTECTED]>
Date: Monday, February 21, 2000 7:03 PM
Subject: Square root function??
>Hi,
>
>To my surprise, I don't seem to find most common mathematical operators
>in Palm SDK. For example, square root, sin, cos, abs, etc. Am I
>missing something here? Thanks.
>
>
>--Richard
>
>
>--
>For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palm.com/devzone/mailinglists.html
>
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html