[Bug fortran/17175] set_exponent breaks with integer*8 exponent

Tobias dot Schlueter at physik dot uni-muenchen dot de gcc-bugzilla@gcc.gnu.org
Thu Aug 26 18:34:00 GMT 2004


------- Additional Comments From Tobias dot Schlueter at physik dot uni-muenchen dot de  2004-08-26 18:33 -------
Subject: Re:  set_exponent breaks with integer*8 exponent

sgk at troutmask dot apl dot washington dot edu wrote:
> I think you are correct that we should convert integer*8 to integer*4.
> We probably want to check that the integer*8 value lies between emin
> and emax for the relevant real kind, then to the conversion.

Range checking would have to happen at runtime, and therefore is costly. I
think that if the user asks for set_exponent(1.,325876358) it would be nice to
return infinity (I don't know if we currently do so) but it's not mandated by
the standard.

Actually, I think the best fix would be having a builtin do the job.
set_exponent is easily implemented: load floating point number in integer
register, replace exponent bits with the exponent the user has asked for
(after adjusting for the bias etc.), return result as float wherever it
belongs. This would also avoid inserting conversions in the frontend.

I'll see if I can do this, I assume that it would be an easy job for someone
who knows more about the frontend, though.

- Tobi


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17175



More information about the Gcc-bugs mailing list