On few systems double is same as long double. How can I detect if long double is of extended precision than double at compile time and use it to conditional compile.
I see there are predefined macros present in libgcc SIZEOF_DOUBLE and SIZEOF_LONG_DOUBLE But there are not portable across different toolchains.
Is there C way to do this?
You could compare DBL_MANT_DIG
and LDBL_MANT_DIG
from float.h
.
You can test e.g.
#if DBL_MANT_DIG < LDBL_MANT_DIG
or similar values defined in float.h
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With