Blame SOURCES/kcalc-4.9.90-misc.patch

8f6d19
diff -ur kcalc-4.9.90/kcalc_core.cpp kcalc-4.9.90-misc/kcalc_core.cpp
8f6d19
--- kcalc-4.9.90/kcalc_core.cpp	2012-11-14 17:46:47.000000000 +0100
8f6d19
+++ kcalc-4.9.90-misc/kcalc_core.cpp	2012-12-08 20:05:58.000000000 +0100
8f6d19
@@ -99,7 +99,13 @@
8f6d19
 }
8f6d19
 
8f6d19
 KNumber ExecMod(const KNumber &left_op, const KNumber &right_op) {
8f6d19
-    return left_op % right_op;
8f6d19
+    KNumber tmp_result = left_op % right_op;
8f6d19
+
8f6d19
+    if ( right_op < KNumber::Zero )
8f6d19
+       return -(-left_op % -right_op);
8f6d19
+    if ( tmp_result < KNumber::Zero )
8f6d19
+       tmp_result += right_op;
8f6d19
+    return tmp_result;
8f6d19
 }
8f6d19
 
8f6d19
 KNumber ExecIntDiv(const KNumber &left_op, const KNumber &right_op) {
8f6d19
@@ -535,8 +541,11 @@
8f6d19
 
8f6d19
 void CalcEngine::Factorial(const KNumber &input)
8f6d19
 {
8f6d19
-    if (input == KNumber::PosInfinity) return;
8f6d19
-    if (input < KNumber::Zero || input.type() == KNumber::TYPE_ERROR) {
8f6d19
+    if (input == KNumber::PosInfinity || input > KNumber(999999)) {
8f6d19
+       last_number_ = KNumber::PosInfinity;
8f6d19
+       return;
8f6d19
+    }
8f6d19
+    if (input < KNumber::Zero || input.type() != KNumber::TYPE_INTEGER) {
8f6d19
         error_ = true;
8f6d19
         last_number_ = KNumber::NaN;
8f6d19
         return;