xref: /csrg-svn/old/eqn/common_source/sqrt.c (revision 11023)
1*11023Sshannon /*	sqrt.c	4.2	83/02/12	*/
211018Sshannon 
311018Sshannon # include "e.h"
411018Sshannon 
511018Sshannon sqrt(p2) int p2; {
6*11023Sshannon #ifndef NEQN
711018Sshannon 	int nps;
8*11023Sshannon 
911018Sshannon 	nps = EFFPS(((eht[p2]*9)/10+5)/6);
10*11023Sshannon #endif NEQN
1111018Sshannon 	yyval = p2;
12*11023Sshannon #ifndef NEQN
1311018Sshannon 	eht[yyval] = VERT( (nps*6*12)/10 );
1411018Sshannon 	if(dbg)printf(".\tsqrt: S%d <- S%d;b=%d, h=%d\n",
1511018Sshannon 		yyval, p2, ebase[yyval], eht[yyval]);
1611018Sshannon 	if (rfont[yyval] == ITAL)
1711018Sshannon 		printf(".as %d \\|\n", yyval);
18*11023Sshannon #endif NEQN
1911018Sshannon 	nrwid(p2, ps, p2);
20*11023Sshannon #ifndef NEQN
2111018Sshannon 	printf(".ds %d \\v'%du'\\s%d\\v'-.2m'\\(sr\\l'\\n(%du\\(rn'\\v'.2m'\\s%d",
2211018Sshannon 		yyval, ebase[p2], nps, p2, ps);
2311018Sshannon 	printf("\\v'%du'\\h'-\\n(%du'\\*(%d\n", -ebase[p2], p2, p2);
2411018Sshannon 	lfont[yyval] = ROM;
25*11023Sshannon #else NEQN
26*11023Sshannon 	printf(".ds %d \\v'%du'\\e\\L'%du'\\l'\\n(%du'",
27*11023Sshannon 		p2, ebase[p2], -eht[p2], p2);
28*11023Sshannon 	printf("\\v'%du'\\h'-\\n(%du'\\*(%d\n", eht[p2]-ebase[p2], p2, p2);
29*11023Sshannon 	eht[p2] += VERT(1);
30*11023Sshannon 	if(dbg)printf(".\tsqrt: S%d <- S%d;b=%d, h=%d\n",
31*11023Sshannon 		p2, p2, ebase[p2], eht[p2]);
32*11023Sshannon #endif NEQN
3311018Sshannon }
34