xref: /original-bsd/lib/libm/tahoe/infnan.s (revision 2301fdfb)
1# Copyright (c) 1985 Regents of the University of California.
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms are permitted
5# provided that the above copyright notice and this paragraph are
6# duplicated in all such forms and that any documentation,
7# advertising materials, and other materials related to such
8# distribution and use acknowledge that the software was developed
9# by the University of California, Berkeley.  The name of the
10# University may not be used to endorse or promote products derived
11# from this software without specific prior written permission.
12# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15#
16# All recipients should regard themselves as participants in an ongoing
17# research project and hence should feel obligated to report their
18# experiences (good or bad) with these elementary function codes, using
19# the sendbug(8) program, to the authors.
20#
21#	@(#)infnan.s	5.4 (Berkeley) 06/30/88
22#
23	.data
24	.align	2
25_sccsid:
26.asciz	"@(#)infnan.s	5.4	(ucb.elefunt)	06/30/88"
27
28/*
29 * double infnan(arg)
30 * int arg;
31 * where arg :=    EDOM	if result is  NaN
32 *	     :=  ERANGE	if result is +INF
33 *	     := -ERANGE if result is -INF
34 *
35 * The Reserved Operand Fault is generated inside of this routine.
36 */
37	.globl	_infnan
38	.set	EDOM,33
39	.set	ERANGE,34
40	.text
41	.align 2
42_infnan:
43	.word	0x0000			# save nothing
44	cmpl	4(fp),$ERANGE
45	bneq	1f
46	movl	$ERANGE,_errno
47	brb	2f
481:	movl	$EDOM,_errno
492:	cmpf2	$0x80000000,$0x80000000	# generates the reserved operand fault
50	ret
51