Miguel Young de la Sota | fa12ce0 | 2019-11-26 14:53:55 -0600 | [diff] [blame] | 1 | // Copyright lowRISC contributors. |
| 2 | // Licensed under the Apache License, Version 2.0, see LICENSE for details. |
| 3 | // SPDX-License-Identifier: Apache-2.0 |
| 4 | |
| 5 | #ifndef OPENTITAN_SW_DEVICE_LIB_BASE_FREESTANDING_FLOAT_H_ |
| 6 | #define OPENTITAN_SW_DEVICE_LIB_BASE_FREESTANDING_FLOAT_H_ |
| 7 | |
| 8 | /** |
Sam Elliott | 2b9bb30 | 2020-02-21 14:10:11 +0000 | [diff] [blame] | 9 | * @file |
| 10 | * @brief C library Floating-point environment (Freestanding) |
| 11 | * |
Miguel Young de la Sota | fa12ce0 | 2019-11-26 14:53:55 -0600 | [diff] [blame] | 12 | * This header implements the float.h standard header, as required by C11 S4p6. |
| 13 | * This header is specified in detail in S7.7 and S5.2.4.2.2 of the same. |
| 14 | * |
| 15 | * The compiler-defined names below are cribbed from |
| 16 | * https://clang.llvm.org/doxygen/float_8h_source.html |
| 17 | */ |
| 18 | |
Sam Elliott | 2b9bb30 | 2020-02-21 14:10:11 +0000 | [diff] [blame] | 19 | #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__ /**< @hideinitializer */ |
| 20 | #define FLT_ROUNDS (-1) /**< @hideinitializer */ |
| 21 | #define FLT_RADIX __FLT_RADIX__ /**< @hideinitializer */ |
Miguel Young de la Sota | fa12ce0 | 2019-11-26 14:53:55 -0600 | [diff] [blame] | 22 | |
Sam Elliott | 2b9bb30 | 2020-02-21 14:10:11 +0000 | [diff] [blame] | 23 | #define FLT_MANT_DIG __FLT_MANT_DIG__ /**< @hideinitializer */ |
| 24 | #define DBL_MANT_DIG __DBL_MANT_DIG__ /**< @hideinitializer */ |
| 25 | #define LDBL_MANT_DIG __LDBL_MANT_DIG__ /**< @hideinitializer */ |
Miguel Young de la Sota | fa12ce0 | 2019-11-26 14:53:55 -0600 | [diff] [blame] | 26 | |
Sam Elliott | 2b9bb30 | 2020-02-21 14:10:11 +0000 | [diff] [blame] | 27 | #define DECIMAL_DIG __DECIMAL_DIG__ /**< @hideinitializer */ |
Miguel Young de la Sota | fa12ce0 | 2019-11-26 14:53:55 -0600 | [diff] [blame] | 28 | |
Sam Elliott | 2b9bb30 | 2020-02-21 14:10:11 +0000 | [diff] [blame] | 29 | #define FLT_DIG __FLT_DIG__ /**< @hideinitializer */ |
| 30 | #define DBL_DIG __DBL_DIG__ /**< @hideinitializer */ |
| 31 | #define LDBL_DIG __LDBL_DIG__ /**< @hideinitializer */ |
Miguel Young de la Sota | fa12ce0 | 2019-11-26 14:53:55 -0600 | [diff] [blame] | 32 | |
Sam Elliott | 2b9bb30 | 2020-02-21 14:10:11 +0000 | [diff] [blame] | 33 | #define FLT_MIN_EXP __FLT_MIN_EXP__ /**< @hideinitializer */ |
| 34 | #define DBL_MIN_EXP __DBL_MIN_EXP__ /**< @hideinitializer */ |
| 35 | #define LDBL_MIN_EXP __LDBL_MIN_EXP__ /**< @hideinitializer */ |
Miguel Young de la Sota | fa12ce0 | 2019-11-26 14:53:55 -0600 | [diff] [blame] | 36 | |
Sam Elliott | 2b9bb30 | 2020-02-21 14:10:11 +0000 | [diff] [blame] | 37 | #define FLT_MIN_10_EXP __FLT_MIN_10_EXP__ /**< @hideinitializer */ |
| 38 | #define DBL_MIN_10_EXP __DBL_MIN_10_EXP__ /**< @hideinitializer */ |
| 39 | #define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__ /**< @hideinitializer */ |
Miguel Young de la Sota | fa12ce0 | 2019-11-26 14:53:55 -0600 | [diff] [blame] | 40 | |
Sam Elliott | 2b9bb30 | 2020-02-21 14:10:11 +0000 | [diff] [blame] | 41 | #define FLT_MAX_EXP __FLT_MAX_EXP__ /**< @hideinitializer */ |
| 42 | #define DBL_MAX_EXP __DBL_MAX_EXP__ /**< @hideinitializer */ |
| 43 | #define LDBL_MAX_EXP __LDBL_MAX_EXP__ /**< @hideinitializer */ |
Miguel Young de la Sota | fa12ce0 | 2019-11-26 14:53:55 -0600 | [diff] [blame] | 44 | |
Sam Elliott | 2b9bb30 | 2020-02-21 14:10:11 +0000 | [diff] [blame] | 45 | #define FLT_MAX_10_EXP __FLT_MAX_10_EXP__ /**< @hideinitializer */ |
| 46 | #define DBL_MAX_10_EXP __DBL_MAX_10_EXP__ /**< @hideinitializer */ |
| 47 | #define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__ /**< @hideinitializer */ |
Miguel Young de la Sota | fa12ce0 | 2019-11-26 14:53:55 -0600 | [diff] [blame] | 48 | |
Sam Elliott | 2b9bb30 | 2020-02-21 14:10:11 +0000 | [diff] [blame] | 49 | #define FLT_MAX __FLT_MAX__ /**< @hideinitializer */ |
| 50 | #define DBL_MAX __DBL_MAX__ /**< @hideinitializer */ |
| 51 | #define LDBL_MAX __LDBL_MAX__ /**< @hideinitializer */ |
Miguel Young de la Sota | fa12ce0 | 2019-11-26 14:53:55 -0600 | [diff] [blame] | 52 | |
Sam Elliott | 2b9bb30 | 2020-02-21 14:10:11 +0000 | [diff] [blame] | 53 | #define FLT_EPSILON __FLT_EPSILON__ /**< @hideinitializer */ |
| 54 | #define DBL_EPSILON __DBL_EPSILON__ /**< @hideinitializer */ |
| 55 | #define LDBL_EPSILON __LDBL_EPSILON__ /**< @hideinitializer */ |
Miguel Young de la Sota | fa12ce0 | 2019-11-26 14:53:55 -0600 | [diff] [blame] | 56 | |
Sam Elliott | 2b9bb30 | 2020-02-21 14:10:11 +0000 | [diff] [blame] | 57 | #define FLT_MIN __FLT_MIN__ /**< @hideinitializer */ |
| 58 | #define DBL_MIN __DBL_MIN__ /**< @hideinitializer */ |
| 59 | #define LDBL_MIN __LDBL_MIN__ /**< @hideinitializer */ |
Miguel Young de la Sota | fa12ce0 | 2019-11-26 14:53:55 -0600 | [diff] [blame] | 60 | |
Sam Elliott | 2b9bb30 | 2020-02-21 14:10:11 +0000 | [diff] [blame] | 61 | #define FLT_TRUE_MIN __FLT_DENORM_MIN__ /**< @hideinitializer */ |
| 62 | #define DBL_TRUE_MIN __DBL_DENORM_MIN__ /**< @hideinitializer */ |
| 63 | #define LDBL_TRUE_MIN __LDBL_DENORM_MIN__ /**< @hideinitializer */ |
Miguel Young de la Sota | fa12ce0 | 2019-11-26 14:53:55 -0600 | [diff] [blame] | 64 | |
Sam Elliott | 2b9bb30 | 2020-02-21 14:10:11 +0000 | [diff] [blame] | 65 | #define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__ /**< @hideinitializer */ |
| 66 | #define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__ /**< @hideinitializer */ |
| 67 | #define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__ /**< @hideinitializer */ |
Miguel Young de la Sota | fa12ce0 | 2019-11-26 14:53:55 -0600 | [diff] [blame] | 68 | |
Sam Elliott | 2b9bb30 | 2020-02-21 14:10:11 +0000 | [diff] [blame] | 69 | #define FLT_HAS_SUBNORM __FLT_HAS_DENORM__ /**< @hideinitializer */ |
| 70 | #define DBL_HAS_SUBNORM __DBL_HAS_DENORM__ /**< @hideinitializer */ |
| 71 | #define LDBL_HAS_SUBNORM __LDBL_HAS_DENORM__ /**< @hideinitializer */ |
Miguel Young de la Sota | fa12ce0 | 2019-11-26 14:53:55 -0600 | [diff] [blame] | 72 | |
| 73 | #endif // OPENTITAN_SW_DEVICE_LIB_BASE_FREESTANDING_FLOAT_H_ |