BSD 4_4 release
[unix-history] / usr / src / lib / libm / tahoe / infnan.s
CommitLineData
70ce639a
KB
1# Copyright (c) 1985, 1993
2# The Regents of the University of California. All rights reserved.
bc0f2b0e 3#
c0567266
KB
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions
6# are met:
7# 1. Redistributions of source code must retain the above copyright
8# notice, this list of conditions and the following disclaimer.
9# 2. Redistributions in binary form must reproduce the above copyright
10# notice, this list of conditions and the following disclaimer in the
11# documentation and/or other materials provided with the distribution.
12# 3. All advertising materials mentioning features or use of this software
13# must display the following acknowledgement:
14# This product includes software developed by the University of
15# California, Berkeley and its contributors.
16# 4. Neither the name of the University nor the names of its contributors
17# may be used to endorse or promote products derived from this software
18# without specific prior written permission.
19#
20# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30# SUCH DAMAGE.
bc0f2b0e 31#
ad787160 32# @(#)infnan.s 8.1 (Berkeley) 6/4/93
bc0f2b0e 33#
e432105d
KB
34 .data
35 .align 2
36_sccsid:
ad787160 37.asciz "@(#)infnan.s 8.1 (ucb.elefunt) 6/4/93"
e432105d
KB
38
39/*
40 * double infnan(arg)
41 * int arg;
42 * where arg := EDOM if result is NaN
43 * := ERANGE if result is +INF
44 * := -ERANGE if result is -INF
45 *
46 * The Reserved Operand Fault is generated inside of this routine.
47 */
48 .globl _infnan
49 .set EDOM,33
50 .set ERANGE,34
51 .text
52 .align 2
53_infnan:
54 .word 0x0000 # save nothing
55 cmpl 4(fp),$ERANGE
56 bneq 1f
57 movl $ERANGE,_errno
58 brb 2f
591: movl $EDOM,_errno
602: cmpf2 $0x80000000,$0x80000000 # generates the reserved operand fault
61 ret