Annotation of researchv10no/cmd/lfactor/min.c, revision 1.1

1.1     ! root        1: /* quad precision input routine.
        !             2:  * reads and converts the next number on the
        !             3:  * standard input after skipping over white space.
        !             4:  */
        !             5: #include <stdio.h>
        !             6: #include "mp.h"
        !             7: 
        !             8: min(a)
        !             9: mint *a;
        !            10: {
        !            11: return(m_in(a, 10, stdin));
        !            12: }
        !            13: 
        !            14: m_in(a,b,f)
        !            15: mint *a;
        !            16: int b;
        !            17: FILE *f;
        !            18: {
        !            19: 
        !            20:        mint x;
        !            21:        mint base;
        !            22:        int sign, c;
        !            23: 
        !            24:        base = itom(b);
        !            25:        sign = 1;
        !            26:        x.high = 0.;
        !            27:        x.low = 0;
        !            28:        while((c = getc(f)) != EOF)
        !            29:        switch(c)
        !            30:        {
        !            31:        case '\\':
        !            32:                getc(f);
        !            33:                continue;
        !            34:        case '\t':
        !            35:        case '\n':
        !            36:                x.high *= sign;
        !            37:                x.low *= sign;
        !            38:                *a = x;
        !            39:                return(0);
        !            40:        case ' ':
        !            41:                continue;
        !            42:        case '-':
        !            43:                sign = -sign;
        !            44:                continue;
        !            45:        default:
        !            46:                if(c>='0' && c<='9'){
        !            47:                        c -= '0';
        !            48:                        x = mult(x, base);
        !            49:                        x = madd(x, itom(c));
        !            50:                        continue;
        !            51:                }else{
        !            52:                        printf("min: bad number format\n");
        !            53:                        exit();
        !            54:                }
        !            55:        }
        !            56:        *a = x;
        !            57:        return(EOF);
        !            58: }

unix.superglobalmegacorp.com

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