home *** CD-ROM | disk | FTP | other *** search
- /*********
- *
- * LOGTEN.C
- *
- * by Ralph Davis
- *
- * Placed in the public domain by Tom Rettig Associates, 10/22/1990.
- *
- * Syntax: LOGTEN( <expN> )
- * Return: Log of <expN> to the base 10 if <expN> >= 0
- INFINITY() if <expN> < 0.
- *********/
-
- #include "trlib.h"
-
- TRTYPE logten()
- {
- double n, ret;
-
- if ( PCOUNT == 1 && ISNUM(1) )
- {
- n = _parnd(1);
-
- if (n < 0) /* Number cannot be negative */
- _retnd(_tr_infinity());
- else
- {
- /* Log of n to the base 10 = Log(n) divided by Log(10) */
-
- ret = _tr_log(n) / _tr_log(10.0);
- _retnd( ret );
- }
- }
- else
- _retnd(ERROR); /* ZERO value if error */
- }
-