xref: /original-bsd/old/eqn/common_source/sqrt.c (revision c577960b)
1 #ifndef lint
2 static char sccsid[] = "@(#)sqrt.c	4.3 08/11/83";
3 #endif
4 
5 # include "e.h"
6 
7 sqrt(p2) int p2; {
8 #ifndef NEQN
9 	int nps;
10 
11 	nps = EFFPS(((eht[p2]*9)/10+5)/6);
12 #endif NEQN
13 	yyval = p2;
14 #ifndef NEQN
15 	eht[yyval] = VERT( (nps*6*12)/10 );
16 	if(dbg)printf(".\tsqrt: S%d <- S%d;b=%d, h=%d\n",
17 		yyval, p2, ebase[yyval], eht[yyval]);
18 	if (rfont[yyval] == ITAL)
19 		printf(".as %d \\|\n", yyval);
20 #endif NEQN
21 	nrwid(p2, ps, p2);
22 #ifndef NEQN
23 	printf(".ds %d \\v'%du'\\s%d\\v'-.2m'\\(sr\\l'\\n(%du\\(rn'\\v'.2m'\\s%d",
24 		yyval, ebase[p2], nps, p2, ps);
25 	printf("\\v'%du'\\h'-\\n(%du'\\*(%d\n", -ebase[p2], p2, p2);
26 	lfont[yyval] = ROM;
27 #else NEQN
28 	printf(".ds %d \\v'%du'\\e\\L'%du'\\l'\\n(%du'",
29 		p2, ebase[p2], -eht[p2], p2);
30 	printf("\\v'%du'\\h'-\\n(%du'\\*(%d\n", eht[p2]-ebase[p2], p2, p2);
31 	eht[p2] += VERT(1);
32 	if(dbg)printf(".\tsqrt: S%d <- S%d;b=%d, h=%d\n",
33 		p2, p2, ebase[p2], eht[p2]);
34 #endif NEQN
35 }
36