Blame SOURCES/kcalc-4.9.90-misc.patch

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