blob: 6a7e010cbbc0085937c1ab6b6d685f3ff3abc629 [file] [log] [blame]
Miguel Young de la Sotafa12ce02019-11-26 14:53:55 -06001// 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 Elliott2b9bb302020-02-21 14:10:11 +00009 * @file
10 * @brief C library Floating-point environment (Freestanding)
11 *
Miguel Young de la Sotafa12ce02019-11-26 14:53:55 -060012 * 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 Elliott2b9bb302020-02-21 14:10:11 +000019#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 Sotafa12ce02019-11-26 14:53:55 -060022
Sam Elliott2b9bb302020-02-21 14:10:11 +000023#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 Sotafa12ce02019-11-26 14:53:55 -060026
Sam Elliott2b9bb302020-02-21 14:10:11 +000027#define DECIMAL_DIG __DECIMAL_DIG__ /**< @hideinitializer */
Miguel Young de la Sotafa12ce02019-11-26 14:53:55 -060028
Sam Elliott2b9bb302020-02-21 14:10:11 +000029#define FLT_DIG __FLT_DIG__ /**< @hideinitializer */
30#define DBL_DIG __DBL_DIG__ /**< @hideinitializer */
31#define LDBL_DIG __LDBL_DIG__ /**< @hideinitializer */
Miguel Young de la Sotafa12ce02019-11-26 14:53:55 -060032
Sam Elliott2b9bb302020-02-21 14:10:11 +000033#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 Sotafa12ce02019-11-26 14:53:55 -060036
Sam Elliott2b9bb302020-02-21 14:10:11 +000037#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 Sotafa12ce02019-11-26 14:53:55 -060040
Sam Elliott2b9bb302020-02-21 14:10:11 +000041#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 Sotafa12ce02019-11-26 14:53:55 -060044
Sam Elliott2b9bb302020-02-21 14:10:11 +000045#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 Sotafa12ce02019-11-26 14:53:55 -060048
Sam Elliott2b9bb302020-02-21 14:10:11 +000049#define FLT_MAX __FLT_MAX__ /**< @hideinitializer */
50#define DBL_MAX __DBL_MAX__ /**< @hideinitializer */
51#define LDBL_MAX __LDBL_MAX__ /**< @hideinitializer */
Miguel Young de la Sotafa12ce02019-11-26 14:53:55 -060052
Sam Elliott2b9bb302020-02-21 14:10:11 +000053#define FLT_EPSILON __FLT_EPSILON__ /**< @hideinitializer */
54#define DBL_EPSILON __DBL_EPSILON__ /**< @hideinitializer */
55#define LDBL_EPSILON __LDBL_EPSILON__ /**< @hideinitializer */
Miguel Young de la Sotafa12ce02019-11-26 14:53:55 -060056
Sam Elliott2b9bb302020-02-21 14:10:11 +000057#define FLT_MIN __FLT_MIN__ /**< @hideinitializer */
58#define DBL_MIN __DBL_MIN__ /**< @hideinitializer */
59#define LDBL_MIN __LDBL_MIN__ /**< @hideinitializer */
Miguel Young de la Sotafa12ce02019-11-26 14:53:55 -060060
Sam Elliott2b9bb302020-02-21 14:10:11 +000061#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 Sotafa12ce02019-11-26 14:53:55 -060064
Sam Elliott2b9bb302020-02-21 14:10:11 +000065#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 Sotafa12ce02019-11-26 14:53:55 -060068
Sam Elliott2b9bb302020-02-21 14:10:11 +000069#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 Sotafa12ce02019-11-26 14:53:55 -060072
73#endif // OPENTITAN_SW_DEVICE_LIB_BASE_FREESTANDING_FLOAT_H_