feat(headers): stddef/stdint/stdbool/limits/float/assert + features wiring

This commit is contained in:
2026-09-03 17:34:16 -04:00
parent ce517ad0d6
commit dec1017527
22 changed files with 2076 additions and 2 deletions
+79
View File
@@ -0,0 +1,79 @@
#ifndef VLIBC_FLOAT_H
#define VLIBC_FLOAT_H
/*
* vlibc — <float.h>.
*
* Characteristics of floating-point types (C23). Every value is derived from
* compiler predefined macros (__FLT_MANT_DIG__, __DBL_MAX__, ...), so this
* header is fully self-contained. The values reflect the x86_64 SSE2
* environment: FLT_RADIX 2, IEC 60559 semantics for float, double and long
* double (the 80-bit extended type).
*
* FLT_ROUNDS is 1 (round to nearest): vlibc does not implement the floating
* environment yet, so the default rounding mode is always active. The fenv
* todo (#42) is expected to replace this with a live read of the x87/MXCSR
* control word.
*
* This header is ISO C core and is present in every profile.
*/
#include <vlibc/features.h>
/* Base of all floating-point types. */
#define FLT_RADIX __FLT_RADIX__
/* Current rounding mode (see the header comment). */
#define FLT_ROUNDS 1
/* Evaluation method (x86_64: all operations use the type's own range). */
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
/* IEC 60559 conformance of each type (C23). */
#define FLT_IS_IEC_60559 __FLT_IS_IEC_60559__
#define DBL_IS_IEC_60559 __DBL_IS_IEC_60559__
#define LDBL_IS_IEC_60559 __LDBL_IS_IEC_60559__
/* float. */
#define FLT_MANT_DIG __FLT_MANT_DIG__
#define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__
#define FLT_DIG __FLT_DIG__
#define FLT_MIN_EXP __FLT_MIN_EXP__
#define FLT_MIN_10_EXP __FLT_MIN_10_EXP__
#define FLT_MAX_EXP __FLT_MAX_EXP__
#define FLT_MAX_10_EXP __FLT_MAX_10_EXP__
#define FLT_MAX __FLT_MAX__
#define FLT_NORM_MAX __FLT_NORM_MAX__
#define FLT_EPSILON __FLT_EPSILON__
#define FLT_MIN __FLT_MIN__
#define FLT_TRUE_MIN __FLT_DENORM_MIN__
/* double. */
#define DBL_MANT_DIG __DBL_MANT_DIG__
#define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__
#define DBL_DIG __DBL_DIG__
#define DBL_MIN_EXP __DBL_MIN_EXP__
#define DBL_MIN_10_EXP __DBL_MIN_10_EXP__
#define DBL_MAX_EXP __DBL_MAX_EXP__
#define DBL_MAX_10_EXP __DBL_MAX_10_EXP__
#define DBL_MAX __DBL_MAX__
#define DBL_NORM_MAX __DBL_NORM_MAX__
#define DBL_EPSILON __DBL_EPSILON__
#define DBL_MIN __DBL_MIN__
#define DBL_TRUE_MIN __DBL_DENORM_MIN__
/* long double (x86_64: 80-bit extended). */
#define LDBL_MANT_DIG __LDBL_MANT_DIG__
#define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__
#define LDBL_DIG __LDBL_DIG__
#define LDBL_MIN_EXP __LDBL_MIN_EXP__
#define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__
#define LDBL_MAX_EXP __LDBL_MAX_EXP__
#define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__
#define LDBL_MAX __LDBL_MAX__
#define LDBL_NORM_MAX __LDBL_NORM_MAX__
#define LDBL_EPSILON __LDBL_EPSILON__
#define LDBL_MIN __LDBL_MIN__
#define LDBL_TRUE_MIN __LDBL_DENORM_MIN__
#endif /* VLIBC_FLOAT_H */