[Fwd: Re: Less than optimally useful gfortran option]

View: New views
3 Messages — Rating Filter:   Alert me  

[Fwd: Re: Less than optimally useful gfortran option]

by Van Snyder :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


-------- Forwarded Message --------
From: Toon Moene <toon@...>
To: Snyder, W Van (3284) <w.van.snyder@...>
Subject: Re: Less than optimally useful gfortran option
Date: Thu, 29 Oct 2009 12:07:20 -0700

Van Snyder wrote:

> The -finit-real=NAN is less than optimally useful, because it
> initializes real variables to a quiet NAN.  It would be more useful if
> it initialized them to a signaling NAN.  Better yet would be to allow
> selecting which kind of NAN is used to initialize real variables, say
> -finit-real=qNAN or -finit-real=sNAN.

I agree - however, I didn't implement this option and its effect.

You are probably better off directing this question straight to
fortran@..., where the person who did is certainly listening in ...

Cheers,



Re: [Fwd: Re: Less than optimally useful gfortran option]

by Steve Kargl :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Oct 29, 2009 at 05:44:32PM -0700, Van Snyder wrote:

>
> -------- Forwarded Message --------
> From: Toon Moene <toon@...>
> To: Snyder, W Van (3284) <w.van.snyder@...>
> Subject: Re: Less than optimally useful gfortran option
> Date: Thu, 29 Oct 2009 12:07:20 -0700
>
> Van Snyder wrote:
>
> > The -finit-real=NAN is less than optimally useful, because it
> > initializes real variables to a quiet NAN.  It would be more useful if
> > it initialized them to a signaling NAN.  Better yet would be to allow
> > selecting which kind of NAN is used to initialize real variables, say
> > -finit-real=qNAN or -finit-real=sNAN.
>
> I agree - however, I didn't implement this option and its effect.
>
> You are probably better off directing this question straight to
> fortran@..., where the person who did is certainly listening in ...
>

If you knew the history, then you won't agree.

--
Steve

Re: [Fwd: Re: Less than optimally useful gfortran option]

by Tobias Burnus :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 10/30/2009 01:44 AM, Van Snyder wrote:
>> The -finit-real=NAN is less than optimally useful, because it
>> initializes real variables to a quiet NAN.  It would be more useful if
>> it initialized them to a signaling NAN.  Better yet would be to allow
>> selecting which kind of NAN is used to initialize real variables, say
>> -finit-real=qNAN or -finit-real=sNAN.
>>    

The problem was that the internal representation in mpfr does not make
the distinction. (Nor did IEEE 754:1985 state how to represent sNaN
bitwiese; IEEE 754:2008 does.) And as mpfr is used to store
floating-point literals in the compiler front end ...

The sNaN support is new in GCC 4.5, see
http://gcc.gnu.org/gcc-4.5/changes.html

The sNaN state is now saved outside of mpfr, which means that doing e.g.
"1 + sNaN" evaluates to "qNaN" (compile time simplification) while   "a
+ sNaN" gives a SIGFPE if the expression is evaluated at run time. As
written in the release notes, one needs to enable FPE otherwise also
sNaN are quiet.

Tobias