Lely core libraries 2.3.4
float.h
Go to the documentation of this file.
1
22#ifndef LELY_UTIL_FLOAT_H_
23#define LELY_UTIL_FLOAT_H_
24
25#include <lely/features.h>
26
27#include <float.h>
28
29#ifndef LELY_FLT16_TYPE
30#if FLT_MANT_DIG == 11 && FLT_MAX_EXP == 16
31#define LELY_FLT16_TYPE float
32#elif DBL_MANT_DIG == 11 && DBL_MAX_EXP == 16
33#define LELY_FLT16_TYPE double
34#elif LDBL_MANT_DIG == 11 && LDBL_MAX_EXP == 16
35#define LELY_FLT16_TYPE long double
36#endif
37#endif
38
39#ifdef LELY_FLT16_TYPE
41typedef LELY_FLT16_TYPE flt16_t;
42#endif
43
44#ifndef LELY_FLT32_TYPE
45#if FLT_MANT_DIG == 24 && FLT_MAX_EXP == 128
46#define LELY_FLT32_TYPE float
47#elif DBL_MANT_DIG == 24 && DBL_MAX_EXP == 128
48#define LELY_FLT32_TYPE double
49#elif LDBL_MANT_DIG == 24 && LDBL_MAX_EXP == 128
50#define LELY_FLT32_TYPE long double
51#endif
52#endif
53
54#ifdef LELY_FLT32_TYPE
56typedef LELY_FLT32_TYPE flt32_t;
57#endif
58
59#ifndef LELY_FLT64_TYPE
60#if FLT_MANT_DIG == 53 && FLT_MAX_EXP == 1024
61#define LELY_FLT64_TYPE float
62#elif DBL_MANT_DIG == 53 && DBL_MAX_EXP == 1024
63#define LELY_FLT64_TYPE double
64#elif LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
65#define LELY_FLT64_TYPE long double
66#endif
67#endif
68
69#ifdef LELY_FLT64_TYPE
71typedef LELY_FLT64_TYPE flt64_t;
72#endif
73
74#endif // !LELY_UTIL_FLOAT_H_
This header file is part of the Lely libraries; it contains the compiler feature definitions.
This header file is part of the utilities library; it contains the IEEE 754 floating-point format typ...