[kcalc] rebase the patch (mod, factorial parts still apply, binomial fixed upstream)

Kevin Kofler kkofler at fedoraproject.org
Sat Dec 8 19:09:34 UTC 2012


commit 72283c7d8ee6318573f86a635eff7e20536c9ec3
Author: Kevin Kofler <Kevin at tigcc.ticalc.org>
Date:   Sat Dec 8 20:09:19 2012 +0100

    rebase the patch (mod, factorial parts still apply, binomial fixed upstream)
    
    * Sat Dec 08 2012 Kevin Kofler <Kevin at tigcc.ticalc.org> - 4.9.90-2
    - rebase the patch (mod, factorial parts still apply, binomial fixed upstream)

 kcalc-4.9.2-misc.patch  |   42 ------------------------------------------
 kcalc-4.9.90-misc.patch |   32 ++++++++++++++++++++++++++++++++
 kcalc.spec              |   12 +++++++-----
 3 files changed, 39 insertions(+), 47 deletions(-)
---
diff --git a/kcalc-4.9.90-misc.patch b/kcalc-4.9.90-misc.patch
new file mode 100644
index 0000000..a529896
--- /dev/null
+++ b/kcalc-4.9.90-misc.patch
@@ -0,0 +1,32 @@
+diff -ur kcalc-4.9.90/kcalc_core.cpp kcalc-4.9.90-misc/kcalc_core.cpp
+--- kcalc-4.9.90/kcalc_core.cpp	2012-11-14 17:46:47.000000000 +0100
++++ kcalc-4.9.90-misc/kcalc_core.cpp	2012-12-08 20:05:58.000000000 +0100
+@@ -99,7 +99,13 @@
+ }
+ 
+ KNumber ExecMod(const KNumber &left_op, const KNumber &right_op) {
+-    return left_op % right_op;
++    KNumber tmp_result = left_op % right_op;
++
++    if ( right_op < KNumber::Zero )
++       return -(-left_op % -right_op);
++    if ( tmp_result < KNumber::Zero )
++       tmp_result += right_op;
++    return tmp_result;
+ }
+ 
+ KNumber ExecIntDiv(const KNumber &left_op, const KNumber &right_op) {
+@@ -535,8 +541,11 @@
+ 
+ void CalcEngine::Factorial(const KNumber &input)
+ {
+-    if (input == KNumber::PosInfinity) return;
+-    if (input < KNumber::Zero || input.type() == KNumber::TYPE_ERROR) {
++    if (input == KNumber::PosInfinity || input > KNumber(999999)) {
++       last_number_ = KNumber::PosInfinity;
++       return;
++    }
++    if (input < KNumber::Zero || input.type() != KNumber::TYPE_INTEGER) {
+         error_ = true;
+         last_number_ = KNumber::NaN;
+         return;
diff --git a/kcalc.spec b/kcalc.spec
index 696ea6a..ad58232 100644
--- a/kcalc.spec
+++ b/kcalc.spec
@@ -1,7 +1,7 @@
 Name: kcalc 
 Summary: Scientific Calculator 
 Version: 4.9.90
-Release: 1%{?dist}
+Release: 2%{?dist}
 
 License: GPLv2+
 URL:     https://projects.kde.org/projects/kde/kdeutils/kcalc
@@ -13,9 +13,8 @@ URL:     https://projects.kde.org/projects/kde/kdeutils/kcalc
 %endif
 Source0: http://download.kde.org/%{stable}/%{version}/src/%{name}-%{version}.tar.xz
 
-# fix arithmetic fault in binomial, factorial
-# FIXME: patch needs rebasing -- rex
-Patch0: kcalc-4.9.2-misc.patch
+# fix arithmetic fault in mod, factorial
+Patch0: kcalc-4.9.90-misc.patch
 
 BuildRequires: desktop-file-utils
 BuildRequires: kdelibs4-devel >= %{version}
@@ -38,7 +37,7 @@ functions than meet the eye on a first glance.
 %prep
 %setup -q -n %{name}-%{version}
 
-#patch0 -p1 -b .misc
+%patch0 -p1 -b .misc
 
 
 %build
@@ -72,6 +71,9 @@ desktop-file-validate %{buildroot}%{_kde4_datadir}/applications/kde4/%{name}.des
 
 
 %changelog
+* Sat Dec 08 2012 Kevin Kofler <Kevin at tigcc.ticalc.org> - 4.9.90-2
+- rebase the patch (mod, factorial parts still apply, binomial fixed upstream)
+
 * Tue Dec 04 2012 Rex Dieter <rdieter at fedoraproject.org> - 4.9.90-1
 - 4.9.90
 


More information about the scm-commits mailing list