SunOS 4.0.3's printf and -0

Arthur David Olson elsie!ado at ncifcrf.gov
Sun Aug 20 06:52:24 AEST 1989


An interesting result from SunOS 4.0.3's printf (with a tip of the hat to
IEEE):

	Script started on Sat Aug 19 15:40:36 1989
	elsie$ cat try.c
	#include <stdio.h>

	main()
	{
		float	f, g, h, i;

		f = -1;
		g = 0;
		h = f * g;
		i = h;
		(void) printf("%g %g\n", h, i);
		if (i == 0)
			i = 0;
		(void) printf("%g %g\n", h, i);
		return 0;
	}
	elsie$ cc try.c
	elsie$ a.out
	-0 -0
	-0 0
	elsie$ exit

	script done on Sat Aug 19 15:40:52 1989
-- 
	Arthur David Olson    ado at alw.nih.gov    ADO is a trademark of Ampex.



More information about the Comp.sys.sun mailing list