xref: /csrg-svn/usr.bin/m4/TEST/sqroot.m4 (revision 62077)
138816Sbostic#
2*62077Sbostic# Copyright (c) 1989, 1993
3*62077Sbostic#	The Regents of the University of California.  All rights reserved.
438816Sbostic#
538816Sbostic# This code is derived from software contributed to Berkeley by
638816Sbostic# Ozan Yigit.
738816Sbostic#
847964Sbostic# %sccs.include.redist.sh%
938816Sbostic#
10*62077Sbostic#	@(#)sqroot.m4	8.1 (Berkeley) 06/06/93
1138816Sbostic#
1238816Sbostic
1338816Sbosticdefine(square_root,
1438816Sbostic	`ifelse(eval($1<0),1,negative-square-root,
1538816Sbostic			     `square_root_aux($1, 1, eval(($1+1)/2))')')
1638816Sbosticdefine(square_root_aux,
1738816Sbostic	`ifelse($3, $2, $3,
1838816Sbostic		$3, eval($1/$2), $3,
1938816Sbostic		`square_root_aux($1, $3, eval(($3+($1/$3))/2))')')
20