double and float in GCC
Kondi
konrad.p.wojciechowski@gmail.com
Thu Jun 23 09:03:00 GMT 2016
I built GCC toolchain for my custom CPU. My custom CPU have 32-bits floating
point unit so I set DOUBLE_TYPE_SIZE 32, to prevent convertion from float to
double. Additionally in newlib I define _DOUBLE_IS_32BITS.
When I ran the GCC test, buildin-math-4.c fails and exactly:
if (sizeof(int)*__CHAR_BIT__ <= __DBL_MANT_DIG__) {
MAXIT(remquo, __INT_MAX__-1.0, __INT_MAX__-1);
The IF condition is met, software use built-in function with params showed
below:
do { q = 12345; if (__builtin_remquof((0x7fffffff -1.0F), 1, &q) != 0 || q
!= (0x7fffffff -1)) link_error (252); } while (0);
When I tried to resolve the problem, I discovered, that inputs params are
converted to float type, and the (__INT_MAX__-1.0) is not converted
corectly, because float type is too small to hold (0x7fffffff -1) value. But
when built-in function is used, all params should be double.
So my question is: how to resolve this problem, how to configure GCC to use
double type in internal calculation and use float type in newlib?
I use GCC version 5.2.0 and newlib version 2.0.0
--
View this message in context: http://gcc.1065356.n5.nabble.com/double-and-float-in-GCC-tp1275275.html
Sent from the gcc - Help mailing list archive at Nabble.com.
More information about the Gcc-help
mailing list