On Tue, 26 Mar 2002, Silvio a Beccara wrote:
> Hello,
>
> thank you for your help; under which version have you tried compiling this,
> and under which OS?
>
[pal06] bohnen $ gpc -v
Reading specs from
/afs/desy.de/user/b/bohnen/.gnu/lib/gcc-lib/i386-suse-linux/2.95.2/specs
gpc version 20020304, based on 2.95.2 19991024 (release)
[pal06] bohnen $ uname -a
Linux pal06 2.4.18 #1 SMP Tue Mar 5 15:27:45 MET 2002 i686 unknown
AFAIK any floating point unit can be configured to treat 'out of
range' FP-numbers (NaNs) as legal infinity/zero values or as errors.
I couldn't find any hint about 'NaN' or 'IEEE' in the gpc - units
directory to control this behavior. If there is no user control on
that, the current behavior of gpc seems to me the best solution.
Otherwise one might run into severe mathematical problems without
any notification.
Ernst-Ludwig
> Regards
>
> Silvio
>
>
> > Hello,
> > I changed your program somewhat:
> >
> > PROGRAM espa;
> > var
> > i, j, k : integer;
> > esp, res : double;
> >
> > begin
> > writeln (exp(1.0));
^^^^^^^^^^^^^^^^^^^ this is garbage, I forgot the value of e
> > for i := 1 to 50000 do
> > begin
> > esp := i * 0.1 ;
> > res := exp ( -esp );
> > writeln (' Minus the exponential of ', esp :5 :1, ' is ', res );
> > end
> > end.
> >
> > Last lines written are:
> > ......
> > Minus the exponential of 744.9 is 4.940656458412465e-324
> > Minus the exponential of 745.0 is 4.940656458412465e-324
> > Minus the exponential of 745.1 is 4.940656458412465e-324
> > espa: error in exponentiation (Numerical result out of range) (error #700
> > at 8049c8a)
> >
> > This indicates that res runs into undefined range between zero and
> > minimum valid value of IEEE double precision numbers.
> > Minimum decimal value is approximately +/- 10**(-323). If your
> > application allows lower values to be interpreted as zero (0.0)
> > you may tell it to gpc, but I don't know how to do that..
> >
> > Ernst-Ludwig
> >
> > On Tue, 26 Mar 2002, Silvio a Beccara wrote:
> > > Hello,
> > >
> > > I tried compiling this simple program, with GPC RC3 (20020304), with GCC
> > > 2.95.3 (20010315).
> > >
> > >
> > > program espa;
> > >
> > >
> > > var
> > >
> > > i, j, k: integer;
> > >
> > > esp: double;
> > >
> > > res: double;
> > >
> > >
> > > begin
> > >
> > >
> > >
> > > for i := 1 to 50 do begin
> > >
> > > esp := i * 1000 ;
> > >
> > > res := exp ( -esp );
> > >
> > > writeln (' Minus the exponential of ', esp :1 :0, ' is ', res :1 :15
> > > );
> > >
> > >
> > > end;
> > >
> > >
> > > end.
> > >
> > >
> > >
> > > Surprisingly, and disappointingly, when I run it I get the following
> > > result:
> > >
> > > espa: error in exponentiation (Numerical result out of range) (error #700
> > > at 8049c75)
> > >
> > > while with any Pascal (like FPC), and C compiler, I get no error (like it
> > > should be ). It really looks like a bug.
> > >
> > > Can anyone help?
> > >
> > > Thanks, regards
> > >
> > > Silvio a Beccara
>