[gnome-calculator] Fixes #756960 e^(-0.5) returned the wrong value
- From: Alberto Ruiz <aruiz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calculator] Fixes #756960 e^(-0.5) returned the wrong value
- Date: Sun, 10 Jan 2016 19:38:29 +0000 (UTC)
commit 5722513a0bb1903f5602a55dcfbb1ac7013003aa
Author: Felix Pelletier <felixpelletier23 gmail com>
Date: Sun Jan 10 19:36:44 2016 +0000
Fixes #756960 e^(-0.5) returned the wrong value
lib/number.vala | 2 +-
tests/test-equation.vala | 1 +
2 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/lib/number.vala b/lib/number.vala
index 0b09248..52475e9 100644
--- a/lib/number.vala
+++ b/lib/number.vala
@@ -507,7 +507,7 @@ public class Number : Object
if (!y.is_integer ())
{
var reciprocal = y.reciprocal ();
- if (reciprocal.is_integer ())
+ if (reciprocal.is_integer () && !reciprocal.is_negative())
return root (reciprocal.to_integer ());
else
return pwr (y);
diff --git a/tests/test-equation.vala b/tests/test-equation.vala
index 80b3898..bde8e9e 100644
--- a/tests/test-equation.vala
+++ b/tests/test-equation.vala
@@ -425,6 +425,7 @@ private void test_equations ()
test ("2^0.5", "1.414213562", 0);
test ("₃√−8", "−2", 0);
test ("(−8)^(1÷3)", "−2", 0);
+ test ("e^(−0.5)", "0.60653066", 0);
test ("0 mod 7", "0", 0);
test ("6 mod 7", "6", 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]