]> git.saurik.com Git - apple/libc.git/blob - ppc/gen/fp.h
Libc-391.tar.gz
[apple/libc.git] / ppc / gen / fp.h
1 /*
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23 /* Copyright (c) 1992, NeXT Computer, Inc. All rights reserved.
24 *
25 * File: libc/m98k/gen/fp.h
26 * Author: Derek B Clegg, NeXT Computer, Inc.
27 *
28 * HISTORY
29 * 11-Nov-92 Derek B Clegg (dclegg@next.com)
30 * Created.
31 *
32 * Common definitions for floating-point numbers.
33 */
34
35 /* The following definitions for for double precision IEEE format numbers. */
36
37 #define EXPONENT_BIAS 1023
38
39 #define SIGN_BITS 1
40 #define EXPONENT_BITS 11
41 #define FRACTION_BITS 52
42 #define HI_FRACTION_BITS 20
43 #define LO_FRACTION_BITS 32
44
45 struct double_format {
46 unsigned sign: SIGN_BITS;
47 unsigned exponent: EXPONENT_BITS;
48 unsigned hi_fraction: HI_FRACTION_BITS;
49 unsigned lo_fraction: LO_FRACTION_BITS;
50 };
51
52 union dbl {
53 struct double_format s;
54 unsigned int u[2];
55 double value;
56 };
57
58 #define PlusInfinity (1.0/0.0)
59 #define MinusInfinity (-1.0/0.0)
60
61 #define not_a_number(x) ((x) != (x))
62 #define positive_infinity(x) ((x) == PlusInfinity)
63 #define negative_infinity(x) ((x) == MinusInfinity)