1*ce099b40Smartin /* $NetBSD: signbitd.c,v 1.2 2008/04/28 20:22:58 martin Exp $ */
2d82e7323Skleink
3d82e7323Skleink /*-
4d82e7323Skleink * Copyright (c) 2003 The NetBSD Foundation, Inc.
5d82e7323Skleink * All rights reserved.
6d82e7323Skleink *
7d82e7323Skleink * This code is derived from software contributed to The NetBSD Foundation
8d82e7323Skleink * by Klaus Klein.
9d82e7323Skleink *
10d82e7323Skleink * Redistribution and use in source and binary forms, with or without
11d82e7323Skleink * modification, are permitted provided that the following conditions
12d82e7323Skleink * are met:
13d82e7323Skleink * 1. Redistributions of source code must retain the above copyright
14d82e7323Skleink * notice, this list of conditions and the following disclaimer.
15d82e7323Skleink * 2. Redistributions in binary form must reproduce the above copyright
16d82e7323Skleink * notice, this list of conditions and the following disclaimer in the
17d82e7323Skleink * documentation and/or other materials provided with the distribution.
18d82e7323Skleink *
19d82e7323Skleink * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20d82e7323Skleink * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21d82e7323Skleink * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22d82e7323Skleink * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23d82e7323Skleink * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24d82e7323Skleink * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25d82e7323Skleink * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26d82e7323Skleink * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27d82e7323Skleink * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28d82e7323Skleink * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29d82e7323Skleink * POSSIBILITY OF SUCH DAMAGE.
30d82e7323Skleink */
31d82e7323Skleink
32d82e7323Skleink #include <sys/cdefs.h>
33d82e7323Skleink #if defined(LIBC_SCCS) && !defined(lint)
34*ce099b40Smartin __RCSID("$NetBSD: signbitd.c,v 1.2 2008/04/28 20:22:58 martin Exp $");
35d82e7323Skleink #endif
36d82e7323Skleink
37d82e7323Skleink #include <machine/vaxfp.h>
38d82e7323Skleink #include <math.h>
39d82e7323Skleink
40d82e7323Skleink /*
41d82e7323Skleink * 7.12.3.6 signbit - determine whether the sign of an argument is negative
42d82e7323Skleink * VAX D_floating version
43d82e7323Skleink */
44d82e7323Skleink int
__signbitd(double x)45d82e7323Skleink __signbitd(double x)
46d82e7323Skleink {
47d82e7323Skleink union vax_dfloating_u u;
48d82e7323Skleink
49d82e7323Skleink u.dfltu_d = x;
50d82e7323Skleink
51d82e7323Skleink return (u.dfltu_dflt.dflt_sign == 1);
52d82e7323Skleink }
53