[libc-commits] [PATCH] D105153: [libc] Add on float properties for precision floating point numbers in FloatProperties.h
Siva Chandra via Phabricator via libc-commits
libc-commits at lists.llvm.org
Tue Jun 29 15:57:39 PDT 2021
sivachandra added inline comments.
================
Comment at: libc/utils/FPUtil/FloatProperties.h:153-154
+template <> struct FloatType<__uint128_t> {
+ static_assert(sizeof(__uint128_t) == sizeof(long double),
+ "Unexpected size of 'long double' type.");
+ typedef long double Type;
----------------
aeubanks wrote:
> does this actually work? I thought long double was 80 bits on Linux/x86
>
> what is the point of `FloatType` anyway? it's going to be ambiguous in the cases where we have `long double == double` since uint64_t will map to both
While this class should go away, I want to point out something about @aeubanks' comment. When we say 80 bits, we are referring to the encoding size and not the storage size. So, while `long double` values are encoded to an 80-bit representation, their storage is 128 bits on Linux/x86_64 and 96 bits on Linux/i386. The additional bits in the storage are garbage padding.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105153/new/
https://reviews.llvm.org/D105153
More information about the libc-commits
mailing list