mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 02:49:21 +02:00
* use generic int64 power
This commit is contained in:
parent
166fe37203
commit
dd08014a49
@ -190,39 +190,12 @@
|
|||||||
power:=exp(ln(bas)*expo);
|
power:=exp(ln(bas)*expo);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{****************************************************************************
|
|
||||||
Longint data type routines
|
|
||||||
****************************************************************************}
|
|
||||||
|
|
||||||
function power(bas,expo : int64) : int64;
|
|
||||||
begin
|
|
||||||
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$
|
$Log$
|
||||||
Revision 1.11 2003-01-15 00:40:18 peter
|
Revision 1.12 2003-01-15 00:45:17 peter
|
||||||
|
* use generic int64 power
|
||||||
|
|
||||||
|
Revision 1.11 2003/01/15 00:40:18 peter
|
||||||
* power returns int64
|
* power returns int64
|
||||||
|
|
||||||
Revision 1.10 2003/01/03 20:34:02 peter
|
Revision 1.10 2003/01/03 20:34:02 peter
|
||||||
|
@ -956,8 +956,11 @@ Function float32_to_int32_round_to_zero( a: Float32 ): longint;
|
|||||||
else
|
else
|
||||||
power:=exp(ln(bas)*expo);
|
power:=exp(ln(bas)*expo);
|
||||||
end;
|
end;
|
||||||
|
{$endif}
|
||||||
|
|
||||||
function power(bas,expo : longint) : longint;
|
|
||||||
|
{$ifndef FPC_SYSTEM_HAS_POWER_INT64}
|
||||||
|
function power(bas,expo : int64) : int64;
|
||||||
begin
|
begin
|
||||||
if bas=0 then
|
if bas=0 then
|
||||||
begin
|
begin
|
||||||
@ -983,6 +986,7 @@ Function float32_to_int32_round_to_zero( a: Float32 ): longint;
|
|||||||
end;
|
end;
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
|
|
||||||
{$ifdef SUPPORT_DOUBLE}
|
{$ifdef SUPPORT_DOUBLE}
|
||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
Helper routines to support old TP styled reals
|
Helper routines to support old TP styled reals
|
||||||
@ -1020,7 +1024,10 @@ Function float32_to_int32_round_to_zero( a: Float32 ): longint;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.9 2002-10-12 20:28:49 carl
|
Revision 1.10 2003-01-15 00:45:17 peter
|
||||||
|
* use generic int64 power
|
||||||
|
|
||||||
|
Revision 1.9 2002/10/12 20:28:49 carl
|
||||||
* round returns int64
|
* round returns int64
|
||||||
|
|
||||||
Revision 1.8 2002/10/07 15:15:02 florian
|
Revision 1.8 2002/10/07 15:15:02 florian
|
||||||
|
Loading…
Reference in New Issue
Block a user