[net.bugs.4bsd] asin a la "-lnm" clobbers registers

ado@elsie.UUCP (05/21/84)

The version of "asin" in the "new math library" clobbers registers 8 and 9.

To see the problem, compile the program below with the "-lnm" option:

	main()
	{
		register	i, j, k, l, m, n;
		extern double	asin();

		i = j = k = l = m = n = 0;
		(void) printf("BEFORE: %2d %2d %13d %13d %2d %2d\n",
			i, j, k, l, m, n);
		(void) asin(0.5);
		(void) printf("AFTER:  %2d %2d %13d %13d %2d %2d\n",
			i, j, k, l, m, n);
	}

The output (on our system) is:
	BEFORE:  0  0             0             0  0  0
	AFTER:   0  0    -333275642   -1197620649  0  0

To fix the problem, redo /usr/lib/libnm.a after replacing the line in
"/usr/src/lib/libnm/asin.s" that reads
		.word	0x0c0
with the following eight lines:
	#
	# Since we may branch to satan,
	# we get to save registers that IT clobbers
	# as well as registers that we clobber.
	# So we change the old
	#	.word	0x0c0
	# to
		.word	0x03c0
--
	...decvax!allegra!umcp-cs!elsie!ado	(301) 496-5688