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

1.1     ! root        1: /*     Copyright (c) 1988 AT&T */
        !             2: /*       All Rights Reserved   */
        !             3: 
        !             4: /*     THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T     */
        !             5: /*     The copyright notice above does not evidence any        */
        !             6: /*     actual or intended publication of such source code.     */
        !             7: 
        !             8: /*     @(#)picasso:math.c      1.0     */
        !             9: #include       "picasso.h"
        !            10: #include       "y.tab.h"
        !            11: 
        !            12: double Log(x)
        !            13:        double  x;
        !            14: {
        !            15:        return errcheck(log(x), "log");
        !            16: }
        !            17: 
        !            18: double Log10(x)
        !            19:        double  x;
        !            20: {
        !            21:        return errcheck(log10(x), "log");
        !            22: }
        !            23: 
        !            24: double Exp(x)
        !            25:        double  x;
        !            26: {
        !            27:        return errcheck(exp(x), "exp");
        !            28: }
        !            29: 
        !            30: double Sqrt(x)
        !            31:        double  x;
        !            32: {
        !            33:        return errcheck(sqrt(x), "sqrt");
        !            34: }
        !            35: 
        !            36: double Cos(x)
        !            37:        double  x;
        !            38: {
        !            39: /*     if (fmod(x,180.) == 90)
        !            40:                return 0;       */
        !            41:        return cos(x/* * M_PI/180 */);
        !            42: }
        !            43: 
        !            44: double Sin(x)
        !            45:        double  x;
        !            46: {
        !            47: /*     if (fmod(x,180.) == 0)
        !            48:                return 0;       */
        !            49:        return sin(x/* * M_PI/180 */);
        !            50: }
        !            51: 
        !            52: double Pow(x, y)
        !            53:        double  x, y;
        !            54: {
        !            55:        return errcheck(pow(x,y), "pow");
        !            56: }
        !            57: 
        !            58: double Atan2(y, x)
        !            59:        double  y, x;
        !            60: {
        !            61:        return (atan2(y, x)/* * 180.0/M_PI */);
        !            62: }
        !            63: 
        !            64: double Minvar(s)
        !            65:        char    *s;
        !            66: {
        !            67:        struct  symtab  *p;
        !            68:        double  m;
        !            69:        int     i;
        !            70: 
        !            71:        p = findvar(s, VARNAME);
        !            72:        if (p->s_dim == 0)
        !            73:                m = p->s_val.f; 
        !            74:        else for (m = p->s_val.a[0], i = 1; i < p->s_dim; ++i)
        !            75:                if (p->s_val.a[i] < m)
        !            76:                        m = p->s_val.a[i];
        !            77:        return m;
        !            78: }
        !            79: 
        !            80: double Minlist()
        !            81: {
        !            82:        double  m;
        !            83: 
        !            84:        for (m = exprlist[--nexpr]; nexpr; )
        !            85:                if (exprlist[--nexpr] < m)
        !            86:                        m = exprlist[nexpr];
        !            87:        return m;
        !            88: }
        !            89: 
        !            90: double Maxvar(s)
        !            91:        char    *s;
        !            92: {
        !            93:        struct  symtab  *p;
        !            94:        double  m;
        !            95:        int     i;
        !            96: 
        !            97:        p = findvar(s, VARNAME);
        !            98:        if (p->s_dim == 0)
        !            99:                m = p->s_val.f; 
        !           100:        else for (m = p->s_val.a[0], i = 1; i < p->s_dim; ++i)
        !           101:                if (p->s_val.a[i] > m)
        !           102:                        m = p->s_val.a[i];
        !           103:        return m;
        !           104: }
        !           105: 
        !           106: double Maxlist()
        !           107: {
        !           108:        double  m;
        !           109: 
        !           110:        for (m = exprlist[--nexpr]; nexpr; )
        !           111:                if (exprlist[--nexpr] > m)
        !           112:                        m = exprlist[nexpr];
        !           113:        return m;
        !           114: }

unix.superglobalmegacorp.com

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