From dd08014a49ddf081c661446e2ec11516da295a27 Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 15 Jan 2003 00:45:17 +0000 Subject: [PATCH] * use generic int64 power --- rtl/i386/math.inc | 35 ++++------------------------------- rtl/inc/genmath.inc | 11 +++++++++-- 2 files changed, 13 insertions(+), 33 deletions(-) diff --git a/rtl/i386/math.inc b/rtl/i386/math.inc index f3a865f947..ca6422d4d3 100644 --- a/rtl/i386/math.inc +++ b/rtl/i386/math.inc @@ -190,39 +190,12 @@ power:=exp(ln(bas)*expo); 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$ - 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 Revision 1.10 2003/01/03 20:34:02 peter diff --git a/rtl/inc/genmath.inc b/rtl/inc/genmath.inc index 2c6d1dd907..42b027bb70 100644 --- a/rtl/inc/genmath.inc +++ b/rtl/inc/genmath.inc @@ -956,8 +956,11 @@ Function float32_to_int32_round_to_zero( a: Float32 ): longint; else power:=exp(ln(bas)*expo); end; +{$endif} - function power(bas,expo : longint) : longint; + +{$ifndef FPC_SYSTEM_HAS_POWER_INT64} + function power(bas,expo : int64) : int64; begin if bas=0 then begin @@ -983,6 +986,7 @@ Function float32_to_int32_round_to_zero( a: Float32 ): longint; end; {$endif} + {$ifdef SUPPORT_DOUBLE} {**************************************************************************** Helper routines to support old TP styled reals @@ -1020,7 +1024,10 @@ Function float32_to_int32_round_to_zero( a: Float32 ): longint; { $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 Revision 1.8 2002/10/07 15:15:02 florian