thank you for your help,
I'll repost my question on a computer architecture or ieee forum. Now
that I could have 'fesetround' work I realize that it was not a gcc-help
topic.
Rgds,
-c
> Tim Prince wrote:
Christian Bruel wrote:
using the attached example, I realize that adding any number to
DBL_MAX gives DBL_MAX, which is perfectly compatible with the ieee 764
rounding default rounding mode.
ITYM IEEE754. DBL_EPSILON*DBL_MAX + DBL_MAX should produce Infinity, as
should nextafter(DBL_MAX,1.). gcc doesn't take responsibility for any
of this, nor does any gcc implementation have full compatibility with C99.
However, doubling DBL_MAX gives infinity, not DBL_MAX. If this an
error from myself or the standard interpretation, what is the rule ?
It's consistent with all the ways I've seen used to detect whether the
implementation works according to IEEE754.
If this is standard, what is the limit for which the result is
'infinity' instead of 'nearest' ?
If the above doesn't answer this, and you think it's on topic, I'll need
a clearer statement of your question.
Another question: is there some support in gcc or the glibc to change
the default rounding mode to be 'infinity' ? I tried 'fesetround'
without success.
That is the responsibility of glibc. As you don't say what you mean by
lack of success, I'll limit my comment. If you succeeded in changing
default rounding mode to infinity, the result of 1 + DBL_MAX should
change to infinity, but I would want to know if the effect on more
useful cases is correct.
oh, forgot to say that the example is compiled with
i586-mandrake-linux-gnu gcc 3.4.3.
attached example compiled with gcc testinf.c -pedantic -ansi -O2
No problem with your gcc command. Guessing about glibc is somewhat
beyond the scope of gcc-help.