]> git.lizzy.rs Git - plan9front.git/blob - sys/src/cmd/eqn/sqrt.c
ndb/dns: remove single-ip-address assuptions
[plan9front.git] / sys / src / cmd / eqn / sqrt.c
1 #include "e.h"
2
3 void sqrt(int p2)
4 {
5         static int af = 0;
6         int nps;        /* point size for radical */
7         double radscale = 0.95;
8
9         if (ttype == DEVPOST)
10                 radscale = 1.05;
11         nps = ps * radscale * eht[p2] / EM(1.0,ps) + 0.99;      /* kludgy */
12         nps = max(EFFPS(nps), ps);
13         yyval = p2;
14         if (ttype == DEVCAT || ttype == DEVAPS)
15                 eht[yyval] = EM(1.2, nps);
16         else if (ttype == DEVPOST)
17                 eht[yyval] = EM(1.15, nps);
18         else            /* DEV202, DEVPOST */
19                 eht[yyval] = EM(1.15, nps);
20         dprintf(".\tS%d <- sqrt S%d;b=%g, h=%g, nps=%d\n", 
21                 yyval, p2, ebase[yyval], eht[yyval], nps);
22         printf(".as %d \\|\n", yyval);
23         nrwid(p2, ps, p2);
24         if (af++ == 0)
25                 printf(".af 10 01\n");  /* make it two digits when it prints */
26         printf(".nr 10 %.3fu*\\n(.su/10\n", 9.2*eht[p2]);       /* this nonsense */
27                         /* guesses point size corresponding to height of stuff */
28         printf(".ds %d \\v'%gm'\\s(\\n(10", yyval, REL(ebase[p2],ps));
29         if (ttype == DEVCAT || ttype == DEVAPS)
30                 printf("\\v'-.2m'\\(sr\\l'\\n(%du\\(rn'\\v'.2m'", p2);
31         else            /* DEV202, DEVPOST so far */
32                 printf("\\(sr\\l'\\n(%du\\(rn'", p2);
33         printf("\\s0\\v'%gm'\\h'-\\n(%du'\\^\\*(%d\n", REL(-ebase[p2],ps), p2, p2);
34         lfont[yyval] = rfont[yyval] = ROM;
35 }