* replaced all HandleError() calls to appropriate float_raise() calls

* added overflow handling for fpc_exp_real
* removed arbitrary tabbing by spaces, improving readability somewhat

git-svn-id: trunk@6061 -
This commit is contained in:
tom_at_work 2007-01-18 22:10:32 +00:00
parent 30db0a17db
commit e501fab034

View File

@ -1,8 +1,8 @@
{
This file is part of the Free Pascal run time library.
Copyright (c) 1999-2001 by Several contributors
Copyright (c) 1999-2007 by Several contributors
Generic mathemtical routines (on type real)
Generic mathematical routines (on type real)
See the file COPYING.FPC, included in this distribution,
for details about the copyright.
@ -610,8 +610,10 @@ invalid:
begin
if( d <= 0.0 ) then
begin
if d < 0.0 then
d:=0/0;
if d < 0.0 then begin
float_raise(float_flag_invalid);
d := 0/0;
end;
result := 0.0;
end
else
@ -697,7 +699,7 @@ invalid:
* = 1 + r + ----------- (for better accuracy)
* 2 - R1(r)
* where
* 2 4 10
2 4 10
* R1(r) = r - (P1*r + P2*r + ... + P5*r ).
*
* 3. Scale back to obtain exp(x):
@ -768,27 +770,23 @@ invalid:
end
else
begin
if xsb=0 then
if xsb=0 then begin
float_raise(float_flag_overflow);
result:=d
else
end else
result:=0.0; { exp(+-inf)=begininf,0end }
exit;
end;
end;
if d > o_threshold then
begin
if d > o_threshold then begin
float_raise(float_flag_overflow); { overflow }
result:=huge*huge;
exit;
end;
if d < u_threshold then
begin
if d < u_threshold then begin
float_raise(float_flag_underflow); { underflow }
result:=twom1000*twom1000;
exit;
end;
end;
{ argument reduction }
if hx > $3fd62e42 then
begin { if |d| > 0.5 ln2 }
@ -885,11 +883,11 @@ invalid:
px, qx, xx : Real;
begin
if( d > MAXLOG) then
HandleError(205)
float_raise(float_flag_overflow)
else
if( d < MINLOG ) then
begin
HandleError(205);
float_raise(float_flag_underflow);
end
else
begin