[net.bugs.usg] bug in hypot

gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (07/06/84)

There is a bug in the hypot(3M) routine in UNIX System V Release
1.0, in that arguments of (0.0, 0.0) cause a divide-by-zero error.
I do not know whether this has been fixed in later releases.
The following editing transcript shows how to fix the bug:

ed - hypot.c
1
/*	@(#)hypot.c	1.6	*/
/\/=/i
	if ( b == 0.0 )				/* DAG -- bug fix */
		return 0.0;			/* DAG */
.
w
q

henry@utzoo.UUCP (Henry Spencer) (07/10/84)

Interesting.  Dunno about later releases, but it was fixed in earlier
ones (V7, no less!).
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,linus,decvax}!utzoo!henry