/*
*	icalc - complex-expression parser
*
*	Standard (real) math routines with domain/range checking, for 
*	complex-number expression parser (almost redundant now...).
*
*	(C) Martin W Scott, 1991.
*/
#include <math.h>
#include <errno.h>
#include "complex.h"
extern	int	errno;

double Log(x)
	double x;
{
	return errcheck(log(x), "log");
}

double errcheck(d, s)	/* check result of library call */
	double d;	/* doesn't seem to work when using IEEE math libs */
	char *s;
{
	if (errno == EDOM) {
		errno = 0;
		execerror(s, "argument out of domain");
	} else if (errno == ERANGE) {
		errno = 0;
		execerror(s, "result out of range");
	}
	return d;
}
