* 0**n where n<>0 is 0; 0**0 generates RTE 207

This commit is contained in:
pierre 2000-05-02 10:37:50 +00:00
parent 19bd9af1af
commit a41bd45aad
3 changed files with 102 additions and 11 deletions

View File

@ -217,7 +217,14 @@
function power(bas,expo : extended) : extended;
begin
if expo=0 then
if bas=0 then
begin
if expo<>0 then
power:=0.0
else
HandleError(207);
end
else if expo=0 then
power:=1
else
{ bas < 0 is not allowed }
@ -234,7 +241,14 @@
function power(bas,expo : longint) : longint;
begin
if expo=0 then
if bas=0 then
begin
if expo<>0 then
power:=0
else
HandleError(207);
end
else if expo=0 then
power:=1
else
begin
@ -370,7 +384,10 @@
{
$Log$
Revision 1.22 2000-04-07 21:29:00 pierre
Revision 1.23 2000-05-02 10:37:50 pierre
* 0**n where n<>0 is 0; 0**0 generates RTE 207
Revision 1.22 2000/04/07 21:29:00 pierre
changed to get nasm to compile system
Revision 1.21 2000/02/15 14:37:36 florian

View File

@ -899,17 +899,54 @@ const sincof : TabCoef = (
function power(bas,expo : real) : real;
begin
power:=exp(ln(bas)*expo);
if bas=0.0 then
begin
if expo<>0.0 then
power:=0.0
else
HandleError(207);
end
else if expo=0.0 then
power:=1
else
{ bas < 0 is not allowed }
if bas<0.0 then
handleerror(207)
else
power:=exp(ln(bas)*expo);
end;
function power(bas,expo : longint) : longint;
begin
power:=round(exp(ln(bas)*expo));
if bas=0 then
begin
if expo<>0 then
power:=0
else
HandleError(207);
end
else if expo=0 then
power:=1
else
begin
if bas<0 then
begin
if odd(expo) then
power:=-round(exp(ln(-bas)*expo))
else
power:=round(exp(ln(-bas)*expo));
end
else
power:=round(exp(ln(bas)*expo));
end;
end;
{
$Log$
Revision 1.3 2000-01-07 16:41:43 daniel
Revision 1.4 2000-05-02 10:37:50 pierre
* 0**n where n<>0 is 0; 0**0 generates RTE 207
Revision 1.3 2000/01/07 16:41:43 daniel
* copyright 2000
Revision 1.2 2000/01/07 16:32:29 daniel
@ -945,4 +982,4 @@ const sincof : TabCoef = (
date: 1997/11/27 13:57:50; author: carl; state: Exp;
m68k implementation of math routines. (Initial version)
=============================================================================
}
}

View File

@ -834,18 +834,55 @@ const sincof : TabCoef = (
function power(bas,expo : real) : real;
begin
power:=exp(ln(bas)*expo);
if bas=0 then
begin
if expo<>0 then
power:=0.0
else
HandleError(207);
end
else if expo=0 then
power:=1
else
{ bas < 0 is not allowed }
if bas<0 then
handleerror(207)
else
power:=exp(ln(bas)*expo);
end;
function power(bas,expo : longint) : longint;
begin
power:=round(exp(ln(bas)*expo));
if bas=0 then
begin
if expo<>0 then
power:=0
else
HandleError(207);
end
else if expo=0 then
power:=1
else
begin
if bas<0 then
begin
if odd(expo) then
power:=-round(exp(ln(-bas)*expo))
else
power:=round(exp(ln(-bas)*expo));
end
else
power:=round(exp(ln(bas)*expo));
end;
end;
{
$Log$
Revision 1.4 2000-01-07 16:41:51 daniel
Revision 1.5 2000-05-02 10:37:50 pierre
* 0**n where n<>0 is 0; 0**0 generates RTE 207
Revision 1.4 2000/01/07 16:41:51 daniel
* copyright 2000
Revision 1.3 2000/01/07 16:32:34 daniel
@ -854,4 +891,4 @@ const sincof : TabCoef = (
Revision 1.2 1998/09/10 13:55:09 peter
* updates
}
}