float.h revision 1.17 1 1.17 christos /* $NetBSD: float.h,v 1.17 2013/05/23 21:39:49 christos Exp $ */
2 1.14 matt
3 1.17 christos /*-
4 1.17 christos * Copyright (c) 2013 The NetBSD Foundation, Inc.
5 1.17 christos * All rights reserved.
6 1.17 christos *
7 1.17 christos * Redistribution and use in source and binary forms, with or without
8 1.17 christos * modification, are permitted provided that the following conditions
9 1.17 christos * are met:
10 1.17 christos * 1. Redistributions of source code must retain the above copyright
11 1.17 christos * notice, this list of conditions and the following disclaimer.
12 1.17 christos * 2. Redistributions in binary form must reproduce the above copyright
13 1.17 christos * notice, this list of conditions and the following disclaimer in the
14 1.17 christos * documentation and/or other materials provided with the distribution.
15 1.17 christos *
16 1.17 christos * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17 1.17 christos * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 1.17 christos * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 1.17 christos * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 1.17 christos * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 1.17 christos * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 1.17 christos * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 1.17 christos * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 1.17 christos * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 1.17 christos * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 1.17 christos * POSSIBILITY OF SUCH DAMAGE.
27 1.17 christos */
28 1.14 matt #ifndef _MIPS_FLOAT_H_
29 1.14 matt #define _MIPS_FLOAT_H_
30 1.14 matt
31 1.16 matt #include <sys/cdefs.h>
32 1.16 matt
33 1.14 matt #if defined(__mips_n32) || defined(__mips_n64)
34 1.14 matt
35 1.15 matt #if __GNUC_PREREQ__(4,1)
36 1.15 matt
37 1.15 matt #define LDBL_MANT_DIG __LDBL_MANT_DIG__
38 1.15 matt #define LDBL_DIG __LDBL_DIG__
39 1.15 matt #define LDBL_MIN_EXP __LDBL_MIN_EXP__
40 1.15 matt #define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__
41 1.15 matt #define LDBL_MAX_EXP __LDBL_MAX_EXP__
42 1.15 matt #define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__
43 1.15 matt #define LDBL_EPSILON __LDBL_EPSILON__
44 1.15 matt #define LDBL_MIN __LDBL_MIN__
45 1.15 matt #define LDBL_MAX __LDBL_MAX__
46 1.15 matt
47 1.15 matt #else
48 1.15 matt
49 1.14 matt #define LDBL_MANT_DIG 113
50 1.14 matt #define LDBL_DIG 33
51 1.14 matt #define LDBL_MIN_EXP (-16381)
52 1.14 matt #define LDBL_MIN_10_EXP (-4931)
53 1.14 matt #define LDBL_MAX_EXP 16384
54 1.14 matt #define LDBL_MAX_10_EXP 4932
55 1.15 matt #if __STDC_VERSION__ >= 199901L
56 1.15 matt #define LDBL_EPSILON 0x1p-112L
57 1.15 matt #define LDBL_MIN 0x1p-16382L
58 1.15 matt #define LDBL_MAX 0x1.ffffffffffffffffffffffffffffp+16383L,
59 1.15 matt #else
60 1.15 matt #define LDBL_EPSILON 1.9259299443872358530559779425849273E-34L
61 1.15 matt #define LDBL_MIN 3.3621031431120935062626778173217526E-4932L
62 1.15 matt #define LDBL_MAX 1.1897314953572317650857593266280070E+4932L
63 1.15 matt #endif
64 1.15 matt
65 1.15 matt #endif /* !__GNUC_PREREQ__(4,1) */
66 1.14 matt
67 1.14 matt #endif /* __mips_n32 || __mips_n64 */
68 1.4 cgd
69 1.13 kleink #include <sys/float_ieee754.h>
70 1.14 matt
71 1.14 matt #if defined(__mips_n32) || defined(__mips_n64)
72 1.14 matt
73 1.14 matt #if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \
74 1.14 matt !defined(_XOPEN_SOURCE) || \
75 1.14 matt ((__STDC_VERSION__ - 0) >= 199901L) || \
76 1.14 matt ((_POSIX_C_SOURCE - 0) >= 200112L) || \
77 1.14 matt ((_XOPEN_SOURCE - 0) >= 600) || \
78 1.14 matt defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
79 1.15 matt #if __GNUC_PREREQ__(4,1)
80 1.15 matt #define DECIMAL_DIG __DECIMAL_DIG__
81 1.15 matt #else
82 1.14 matt #define DECIMAL_DIG 36
83 1.15 matt #endif
84 1.14 matt #endif /* !defined(_ANSI_SOURCE) && ... */
85 1.14 matt
86 1.14 matt #endif /* __mips_n32 || __mips_n64 */
87 1.14 matt
88 1.14 matt #endif /* _MIPS_FLOAT_H_ */
89