mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 19:57:44 +00:00
AK: Introduce fixed-width floating point types (f32, f64, f80 and f128)
This commit is contained in:
parent
266882937d
commit
73f4cfa930
2 changed files with 23 additions and 11 deletions
16
AK/Types.h
16
AK/Types.h
|
@ -19,6 +19,22 @@ using i32 = __INT32_TYPE__;
|
|||
using i16 = __INT16_TYPE__;
|
||||
using i8 = __INT8_TYPE__;
|
||||
|
||||
#ifndef KERNEL
|
||||
using f32 = float;
|
||||
static_assert(__FLT_MANT_DIG__ == 24 && __FLT_MAX_EXP__ == 128);
|
||||
|
||||
using f64 = double;
|
||||
static_assert(__DBL_MANT_DIG__ == 53 && __DBL_MAX_EXP__ == 1024);
|
||||
|
||||
# if __LDBL_MANT_DIG__ == 64 && __LDBL_MAX_EXP__ == 16384
|
||||
# define AK_HAS_FLOAT_80 1
|
||||
using f80 = long double;
|
||||
# elif __LDBL_MANT_DIG__ == 113 && __LDBL_MAX_EXP__ == 16384
|
||||
# define AK_HAS_FLOAT_128 1
|
||||
using f128 = long double;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef AK_OS_SERENITY
|
||||
|
||||
using size_t = __SIZE_TYPE__;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue