PIPS
float_p.h File Reference
#include <float.h>
#include <limits.h>
+ Include dependency graph for float_p.h:

Go to the source code of this file.

Macros

#define FLT_EXP_MASK   ((FLT_MAX_EXP - FLT_MIN_EXP) | 7)
 Supplemental information about the floating-point formats. More...
 
#define DBL_EXP_MASK   ((DBL_MAX_EXP - DBL_MIN_EXP) | 7)
 
#define LDBL_EXP_MASK   ((LDBL_MAX_EXP - LDBL_MIN_EXP) | 7)
 
#define FLT_EXP_BIT
 Number of bits used for the exponent of a floating-point number, including the exponent's sign. More...
 
#define DBL_EXP_BIT
 
#define LDBL_EXP_BIT
 
#define FLT_TOTAL_BIT   ((FLT_MANT_BIT - 1) + FLT_EXP_BIT + 1)
 Number of bits used for a floating-point number: the mantissa (not counting the "hidden bit", since it may or may not be explicit), the exponent, and the sign. More...
 
#define DBL_TOTAL_BIT   ((DBL_MANT_BIT - 1) + DBL_EXP_BIT + 1)
 
#define LDBL_TOTAL_BIT   ((LDBL_MANT_BIT - 1) + LDBL_EXP_BIT + 1)
 
#define SIZEOF_FLT   ((FLT_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT)
 Number of bytes used for a floating-point number. More...
 
#define SIZEOF_DBL   ((DBL_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT)
 
#define SIZEOF_LDBL   ((LDBL_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT)
 

Typedefs

typedef int verify_sizeof_flt[SIZEOF_FLT<=sizeof(float) ? 1 :-1]
 Verify that SIZEOF_FLT <= sizeof (float) etc. More...
 
typedef int verify_sizeof_dbl[SIZEOF_DBL<=sizeof(double) ? 1 :- 1]
 
typedef int verify_sizeof_ldbl[SIZEOF_LDBL<=sizeof(long double) ? 1 :- 1]
 

Macro Definition Documentation

◆ DBL_EXP_BIT

#define DBL_EXP_BIT
Value:
(DBL_EXP_MASK < 0x100 ? 8 : \
DBL_EXP_MASK < 0x200 ? 9 : \
DBL_EXP_MASK < 0x400 ? 10 : \
DBL_EXP_MASK < 0x800 ? 11 : \
DBL_EXP_MASK < 0x1000 ? 12 : \
DBL_EXP_MASK < 0x2000 ? 13 : \
DBL_EXP_MASK < 0x4000 ? 14 : \
DBL_EXP_MASK < 0x8000 ? 15 : \
DBL_EXP_MASK < 0x10000 ? 16 : \
DBL_EXP_MASK < 0x20000 ? 17 : \
DBL_EXP_MASK < 0x40000 ? 18 : \
DBL_EXP_MASK < 0x80000 ? 19 : \
DBL_EXP_MASK < 0x100000 ? 20 : \
DBL_EXP_MASK < 0x200000 ? 21 : \
DBL_EXP_MASK < 0x400000 ? 22 : \
DBL_EXP_MASK < 0x800000 ? 23 : \
DBL_EXP_MASK < 0x1000000 ? 24 : \
DBL_EXP_MASK < 0x2000000 ? 25 : \
DBL_EXP_MASK < 0x4000000 ? 26 : \
DBL_EXP_MASK < 0x8000000 ? 27 : \
DBL_EXP_MASK < 0x10000000 ? 28 : \
DBL_EXP_MASK < 0x20000000 ? 29 : \
DBL_EXP_MASK < 0x40000000 ? 30 : \
DBL_EXP_MASK <= 0x7fffffff ? 31 : \
32)
#define DBL_EXP_MASK
Definition: float_p.h:42

Definition at line 73 of file float_p.h.

◆ DBL_EXP_MASK

#define DBL_EXP_MASK   ((DBL_MAX_EXP - DBL_MIN_EXP) | 7)

Definition at line 42 of file float_p.h.

◆ DBL_TOTAL_BIT

#define DBL_TOTAL_BIT   ((DBL_MANT_BIT - 1) + DBL_EXP_BIT + 1)

Definition at line 130 of file float_p.h.

◆ FLT_EXP_BIT

#define FLT_EXP_BIT
Value:
(FLT_EXP_MASK < 0x100 ? 8 : \
FLT_EXP_MASK < 0x200 ? 9 : \
FLT_EXP_MASK < 0x400 ? 10 : \
FLT_EXP_MASK < 0x800 ? 11 : \
FLT_EXP_MASK < 0x1000 ? 12 : \
FLT_EXP_MASK < 0x2000 ? 13 : \
FLT_EXP_MASK < 0x4000 ? 14 : \
FLT_EXP_MASK < 0x8000 ? 15 : \
FLT_EXP_MASK < 0x10000 ? 16 : \
FLT_EXP_MASK < 0x20000 ? 17 : \
FLT_EXP_MASK < 0x40000 ? 18 : \
FLT_EXP_MASK < 0x80000 ? 19 : \
FLT_EXP_MASK < 0x100000 ? 20 : \
FLT_EXP_MASK < 0x200000 ? 21 : \
FLT_EXP_MASK < 0x400000 ? 22 : \
FLT_EXP_MASK < 0x800000 ? 23 : \
FLT_EXP_MASK < 0x1000000 ? 24 : \
FLT_EXP_MASK < 0x2000000 ? 25 : \
FLT_EXP_MASK < 0x4000000 ? 26 : \
FLT_EXP_MASK < 0x8000000 ? 27 : \
FLT_EXP_MASK < 0x10000000 ? 28 : \
FLT_EXP_MASK < 0x20000000 ? 29 : \
FLT_EXP_MASK < 0x40000000 ? 30 : \
FLT_EXP_MASK <= 0x7fffffff ? 31 : \
32)
#define FLT_EXP_MASK
Supplemental information about the floating-point formats.
Definition: float_p.h:41

Number of bits used for the exponent of a floating-point number, including the exponent's sign.


Definition at line 47 of file float_p.h.

◆ FLT_EXP_MASK

#define FLT_EXP_MASK   ((FLT_MAX_EXP - FLT_MIN_EXP) | 7)

Supplemental information about the floating-point formats.

Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc. Written by Bruno Haible bruno.nosp@m.@cli.nosp@m.sp.or.nosp@m.g, 2007.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, see http://www.gnu.org/licenses/.
Number of bits in the mantissa of a floating-point number, including the "hidden bit".
Bit mask that can be used to mask the exponent, as an unsigned number.

Definition at line 41 of file float_p.h.

◆ FLT_TOTAL_BIT

#define FLT_TOTAL_BIT   ((FLT_MANT_BIT - 1) + FLT_EXP_BIT + 1)

Number of bits used for a floating-point number: the mantissa (not counting the "hidden bit", since it may or may not be explicit), the exponent, and the sign.


Definition at line 129 of file float_p.h.

◆ LDBL_EXP_BIT

#define LDBL_EXP_BIT
Value:
(LDBL_EXP_MASK < 0x100 ? 8 : \
LDBL_EXP_MASK < 0x200 ? 9 : \
LDBL_EXP_MASK < 0x400 ? 10 : \
LDBL_EXP_MASK < 0x800 ? 11 : \
LDBL_EXP_MASK < 0x1000 ? 12 : \
LDBL_EXP_MASK < 0x2000 ? 13 : \
LDBL_EXP_MASK < 0x4000 ? 14 : \
LDBL_EXP_MASK < 0x8000 ? 15 : \
LDBL_EXP_MASK < 0x10000 ? 16 : \
LDBL_EXP_MASK < 0x20000 ? 17 : \
LDBL_EXP_MASK < 0x40000 ? 18 : \
LDBL_EXP_MASK < 0x80000 ? 19 : \
LDBL_EXP_MASK < 0x100000 ? 20 : \
LDBL_EXP_MASK < 0x200000 ? 21 : \
LDBL_EXP_MASK < 0x400000 ? 22 : \
LDBL_EXP_MASK < 0x800000 ? 23 : \
LDBL_EXP_MASK < 0x1000000 ? 24 : \
LDBL_EXP_MASK < 0x2000000 ? 25 : \
LDBL_EXP_MASK < 0x4000000 ? 26 : \
LDBL_EXP_MASK < 0x8000000 ? 27 : \
LDBL_EXP_MASK < 0x10000000 ? 28 : \
LDBL_EXP_MASK < 0x20000000 ? 29 : \
LDBL_EXP_MASK < 0x40000000 ? 30 : \
LDBL_EXP_MASK <= 0x7fffffff ? 31 : \
32)
#define LDBL_EXP_MASK
Definition: float_p.h:43

Definition at line 99 of file float_p.h.

◆ LDBL_EXP_MASK

#define LDBL_EXP_MASK   ((LDBL_MAX_EXP - LDBL_MIN_EXP) | 7)

Definition at line 43 of file float_p.h.

◆ LDBL_TOTAL_BIT

#define LDBL_TOTAL_BIT   ((LDBL_MANT_BIT - 1) + LDBL_EXP_BIT + 1)

Definition at line 131 of file float_p.h.

◆ SIZEOF_DBL

#define SIZEOF_DBL   ((DBL_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT)

Definition at line 139 of file float_p.h.

◆ SIZEOF_FLT

#define SIZEOF_FLT   ((FLT_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT)

Number of bytes used for a floating-point number.

This can be smaller than the 'sizeof'. For example, on i386 systems, 'long double' most often have LDBL_MANT_BIT = 64, LDBL_EXP_BIT = 16, hence LDBL_TOTAL_BIT = 80 bits, i.e. 10 bytes of consecutive memory, but sizeof (long double) = 12 or = 16.

Definition at line 138 of file float_p.h.

◆ SIZEOF_LDBL

#define SIZEOF_LDBL   ((LDBL_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT)

Definition at line 140 of file float_p.h.

Typedef Documentation

◆ verify_sizeof_dbl

typedef int verify_sizeof_dbl[SIZEOF_DBL<=sizeof(double) ? 1 :- 1]

Definition at line 144 of file float_p.h.

◆ verify_sizeof_flt

typedef int verify_sizeof_flt[SIZEOF_FLT<=sizeof(float) ? 1 :-1]

Verify that SIZEOF_FLT <= sizeof (float) etc.


Definition at line 143 of file float_p.h.

◆ verify_sizeof_ldbl

typedef int verify_sizeof_ldbl[SIZEOF_LDBL<=sizeof(long double) ? 1 :- 1]

Definition at line 145 of file float_p.h.