mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-24 05:59:34 +02:00
* fpc_ln_real raises an exception for invalid operands if they exception is not masked
git-svn-id: trunk@47813 -
This commit is contained in:
parent
072be7b0f7
commit
1d92cc43bb
@ -1443,9 +1443,15 @@ end;
|
||||
if (hx < $00100000) then { x < 2**-1022 }
|
||||
begin
|
||||
if (((hx and $7fffffff) or longint(lx))=0) then
|
||||
exit(-two54/zero); { log(+-0)=-inf }
|
||||
begin
|
||||
float_raise(float_flag_divbyzero);
|
||||
exit(-two54/zero); { log(+-0)=-inf }
|
||||
end;
|
||||
if (hx<0) then
|
||||
exit((d-d)/zero); { log(-#) = NaN }
|
||||
begin
|
||||
float_raise(float_flag_invalid);
|
||||
exit((d-d)/zero); { log(-#) = NaN }
|
||||
end;
|
||||
dec(k, 54); d := d * two54; { subnormal number, scale up x }
|
||||
hx := float64high(d);
|
||||
end;
|
||||
|
@ -123,6 +123,18 @@ begin
|
||||
end;
|
||||
end;
|
||||
test_exception('ln(-1)');
|
||||
try
|
||||
exception_called:=false;
|
||||
i := 0;
|
||||
e := ln(i);
|
||||
except
|
||||
on e : exception do
|
||||
begin
|
||||
Writeln('exception called ',e.message);
|
||||
exception_called:=true;
|
||||
end;
|
||||
end;
|
||||
test_exception('ln(0)');
|
||||
if program_has_errors then
|
||||
Halt(1);
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user