Annotation of researchv10no/cmd/hoc/math.c, revision 1.1

1.1     ! root        1: #include <math.h>
        !             2: #include <errno.h>
        !             3: extern int     errno;
        !             4: double errcheck();
        !             5: 
        !             6: double Log(x)
        !             7:        double x;
        !             8: {
        !             9:        return errcheck(log(x), "log");
        !            10: }
        !            11: double Log10(x)
        !            12:        double x;
        !            13: {
        !            14:        return errcheck(log10(x), "log10");
        !            15: }
        !            16: 
        !            17: double Sqrt(x)
        !            18:        double x;
        !            19: {
        !            20:        return errcheck(sqrt(x), "sqrt");
        !            21: }
        !            22: 
        !            23: double Gamma(x)
        !            24:        double x;
        !            25: {
        !            26:        double y;
        !            27:        extern int signgam;
        !            28:        y=errcheck(gamma(x), "gamma");
        !            29:        if(y>88.0)
        !            30:                execerror("gamma result out of range", (char *)0);
        !            31:        return signgam*exp(y);
        !            32: }
        !            33: 
        !            34: double Exp(x)
        !            35:        double x;
        !            36: {
        !            37:        return errcheck(exp(x), "exp");
        !            38: }
        !            39: 
        !            40: double Asin(x)
        !            41:        double x;
        !            42: {
        !            43:        return errcheck(asin(x), "asin");
        !            44: }
        !            45: 
        !            46: double Acos(x)
        !            47:        double x;
        !            48: {
        !            49:        return errcheck(acos(x), "acos");
        !            50: }
        !            51: 
        !            52: double Sinh(x)
        !            53:        double x;
        !            54: {
        !            55:        return errcheck(sinh(x), "sinh");
        !            56: }
        !            57: 
        !            58: double Cosh(x)
        !            59:        double x;
        !            60: {
        !            61:        return errcheck(cosh(x), "cosh");
        !            62: }
        !            63: 
        !            64: double Pow(x, y)
        !            65:        double x, y;
        !            66: {
        !            67:        return errcheck(pow(x,y), "exponentiation");
        !            68: }
        !            69: 
        !            70: double integer(x)
        !            71:        double x;
        !            72: {
        !            73:        return (double)(long)x;
        !            74: }
        !            75: 
        !            76: double errcheck(d, s)  /* check result of library call */
        !            77:        double d;
        !            78:        char *s;
        !            79: {
        !            80:        if (errno == EDOM) {
        !            81:                errno = 0;
        !            82:                execerror(s, "argument out of domain");
        !            83:        } else if (errno == ERANGE) {
        !            84:                errno = 0;
        !            85:                execerror(s, "result out of range");
        !            86:        }
        !            87:        return d;
        !            88: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.