xref: /titanic_50/usr/src/cmd/eqn/sqrt.c (revision 554ff184129088135ad2643c1c9832174a17be88)
1 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
2 /*	  All Rights Reserved  	*/
3 
4 
5 /*
6  * Copyright (c) 1980 Regents of the University of California.
7  * All rights reserved. The Berkeley software License Agreement
8  * specifies the terms and conditions for redistribution.
9  */
10 
11 /*
12  * Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc.
13  * All Rights Reserved.
14  */
15 
16 #ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.1	*/
17 
18 # include "e.h"
19 
20 sqrt(p2) int p2; {
21 #ifndef NEQN
22 	int nps;
23 
24 	nps = EFFPS(((eht[p2]*9)/10+(resolution/POINT-1))/(resolution/POINT));
25 #endif NEQN
26 	yyval = p2;
27 #ifndef NEQN
28 	eht[yyval] = VERT(EM(1.2, nps));
29 	if(dbg)printf(".\tsqrt: S%d <- S%d;b=%d, h=%d\n",
30 		yyval, p2, ebase[yyval], eht[yyval]);
31 	if (rfont[yyval] == ITAL)
32 		printf(".as %d \\|\n", yyval);
33 #endif NEQN
34 	nrwid(p2, ps, p2);
35 #ifndef NEQN
36 	printf(".ds %d \\v'%du'\\s%d\\v'-.2m'\\(sr\\l'\\n(%du\\(rn'\\v'.2m'\\s%d",
37 		yyval, ebase[p2], nps, p2, ps);
38 	printf("\\v'%du'\\h'-\\n(%du'\\*(%d\n", -ebase[p2], p2, p2);
39 	lfont[yyval] = ROM;
40 #else NEQN
41 	printf(".ds %d \\v'%du'\\e\\L'%du'\\l'\\n(%du'",
42 		p2, ebase[p2], -eht[p2], p2);
43 	printf("\\v'%du'\\h'-\\n(%du'\\*(%d\n", eht[p2]-ebase[p2], p2, p2);
44 	eht[p2] += VERT(1);
45 	if(dbg)printf(".\tsqrt: S%d <- S%d;b=%d, h=%d\n",
46 		p2, p2, ebase[p2], eht[p2]);
47 #endif NEQN
48 }
49