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