summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleix Pol <[email protected]>2016-06-15 16:18:01 +0200
committerAleix Pol <[email protected]>2016-06-15 16:18:01 +0200
commit79374b86063fa4cd851fbc850a3ec8a79974ecfc (patch)
treec900593e330f5fffb7e1a54606e3900db0200faf
parentee5838edd1a5b4dc08a9130e78296409efb76021 (diff)
Revert change
Don't use lgammaf to calculate factorials It doesn't work anymore, I'm unsure what happened TBH
-rw-r--r--analitza/operations.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/analitza/operations.cpp b/analitza/operations.cpp
index 2c85328..bd69abc 100644
--- a/analitza/operations.cpp
+++ b/analitza/operations.cpp
@@ -359,9 +359,14 @@ Cn* reduceUnaryReal(Operator::OperatorType op, Cn* oper, QString** correct)
case Operator::minus:
oper->setValue(-a);
break;
- case Operator::factorial:
- oper->setValue(std::lgammaf(a));
- break;
+ case Operator::factorial: {
+ //Use gamma from math.h?
+ uint res=1;
+ for(int i=a; i>1.; i--) {
+ res*=floor(i);
+ }
+ oper->setValue(res);
+ } break;
case Operator::sin:
oper->setValue(sin(a));
break;