xref: /original-bsd/usr.bin/m4/TEST/sqroot.m4 (revision 47436896)
1#
2# Copyright (c) 1989 The Regents of the University of California.
3# All rights reserved.
4#
5# This code is derived from software contributed to Berkeley by
6# Ozan Yigit.
7#
8# %sccs.include.redist.sh%
9#
10#	@(#)sqroot.m4	5.2 (Berkeley) 04/12/91
11#
12
13define(square_root,
14	`ifelse(eval($1<0),1,negative-square-root,
15			     `square_root_aux($1, 1, eval(($1+1)/2))')')
16define(square_root_aux,
17	`ifelse($3, $2, $3,
18		$3, eval($1/$2), $3,
19		`square_root_aux($1, $3, eval(($3+($1/$3))/2))')')
20