[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    [PATCH] make kdeutils/kcalc compile with gcc3.1
From:       Martin Habbecke <M.Habbecke () gmx ! de>
Date:       2002-07-09 14:53:26
[Download RAW message or body]

Hi,

gcc3.1 is not able to resolve some ambiguous pow()-calls -- at least not on my 
machine. The attached patch adds some casts that fix the problem.

Martin


["kcalc.patch" (text/x-diff)]

Index: kcalc_core.cpp
===================================================================
RCS file: /home/kdecvs/kde/kdeutils/kcalc/kcalc_core.cpp,v
retrieving revision 1.51
diff -u -3 -p -r1.51 kcalc_core.cpp
--- kcalc_core.cpp	22 May 2002 01:05:19 -0000	1.51
+++ kcalc_core.cpp	9 Jul 2002 14:43:39 -0000
@@ -371,12 +371,12 @@ void QtCalculator::EnterDigit(int data)
 		if (DISPLAY_AMOUNT < 0) {
 			DISPLAY_AMOUNT = decimal_point ?
 			DISPLAY_AMOUNT - ((CALCAMNT)data /
-			POW(current_base, decimal_point++)) :
+			POW((CALCAMNT) current_base, decimal_point++)) :
 			(current_base * DISPLAY_AMOUNT) - data;
 		} else {
 			DISPLAY_AMOUNT = decimal_point ?
 			DISPLAY_AMOUNT + ((CALCAMNT)data /
-			POW(current_base, decimal_point++)) :
+			POW((CALCAMNT) current_base, decimal_point++)) :
 			(current_base * DISPLAY_AMOUNT) + data;
 		}
 	}
@@ -402,8 +402,8 @@ void QtCalculator::SubtractDigit()
 				DISPLAY_AMOUNT = floor(DISPLAY_AMOUNT);
 			} else {
 				--decimal_point;
-				DISPLAY_AMOUNT = floor(DISPLAY_AMOUNT * POW(current_base, decimal_point - 1)) /
-				POW(current_base, (decimal_point - 1));
+				DISPLAY_AMOUNT = floor(DISPLAY_AMOUNT * POW((CALCAMNT) current_base, decimal_point - 1)) /
+				POW((CALCAMNT) current_base, (decimal_point - 1));
 			}
 		} else {
 			DISPLAY_AMOUNT = floor(DISPLAY_AMOUNT / current_base);

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic