3.5.6. math.c
3.5.6. math.c
#include <math.h>
#include <errno.h>
extern int errno;
double errcheck();
double Log(x)
double x;
{
return errcheck(log(x), "log");
}
double Log10(x)
double x;
{
return errcheck(log10(x), "log10");
}
double Sqrt(x)
double x;
{
return errcheck(sqrt(x), "sqrt");
}
double Exp(x)
double x;
{
return errcheck(exp(x), "exp");
}
double Pow(x, y)
double x, y;
{
return errcheck(pow(x,y), "exponentiation");
}
double integer(x)
double x;
{
return (double)(long)x;
}
double errcheck(d, s) /* check result of library call */
double d;
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;
}
Более 800 000 книг и аудиокниг! 📚
Получи 2 месяца Литрес Подписки в подарок и наслаждайся неограниченным чтением
ПОЛУЧИТЬ ПОДАРОКДанный текст является ознакомительным фрагментом.
Читайте также
Объект Math
Объект Math Для математических вычислений JavaScript поддерживает объект Math, который содержит ряд математических констант и функций (табл. 11.25 и 11.26).Таблица 11.25. Свойства объекта Math Таблица 11.26. Методы объекта
Объект Math
Объект Math Встроенный класс Math применяется для математических вычислений и содержит основные математические константы и функции. Замечание Объект Math создается сервером сценариев автоматически и не может быть создан при помощи оператора new, как другие встроенные
3.4.6 math.c
3.4.6 math.c #include <math.h>#include <errno.h>extern int errno;double errcheck();double Log(x) double x;{ return errcheck(log(x), "log");}double Log10(x) double x;{ return errcheck(log10(x), "log10");}double Sqrt(x) double x;{ return errcheck(sqrt(x), "sqrt");}double Exp(x) double x;{ return errcheck(exp(x), "exp");}double Pow(x, y) double x, y;{ return errcheck(pow(x,y), "exponentiation");}double integer(x) double x;{ return (double)(long)x;}double errcheck(d, s) /*
3.5.6. math.c
3.5.6. math.c #include <math.h>#include <errno.h>extern int errno;double errcheck();double Log(x) double x;{ return errcheck(log(x), "log");}double Log10(x) double x;{ return errcheck(log10(x), "log10");}double Sqrt(x) double x;{ return errcheck(sqrt(x), "sqrt");}double Exp(x) double x;{ return errcheck(exp(x), "exp");}double Pow(x, y) double x, y;{ return errcheck(pow(x,y), "exponentiation");}double integer(x) double x;{ return (double)(long)x;}double errcheck(d, s) /*
3.6.8 math.c
3.6.8 math.c #include <math.h>#include <errno.h>extern int errno;double errcheck();double Log(x) double x;{ return errcheck(log(x), "log");}double Log10(x) double x;{ return errcheck(log10(x), "log10");}double Sqrt(x) double x;{ return errcheck(sqrt(x), "sqrt");}double Exp(x) double x;{ return errcheck(exp(x), "exp");}double Pow(x, y) double x, y;{ return errcheck(pow(x,y), "exponentiation");}double integer(x) double x;{ return (double)(long)x;}double errcheck(d, s) /*
3.7.18 math.c
3.7.18 math.c #include <math.h>#include <errno.h>extern int errno;double errcheck();double Log(x) double x;{ return errcheck(log(x), "log");}double Log10(x) double x;{ return errcheck(log10(x), "log10");}double Sqrt(x) double x;{ return errcheck(sqrt(x), "sqrt");}double Exp(x) double x;{ return errcheck(exp(x), "exp");}double Pow(x, y) double x, y;{ return errcheck(pow(x,y), "exponentiation");}double integer(x) double x;{ return (double)(long)x;}double errcheck(d, s) /*