[gnome-calculator] Fix precision loss of ln(e^1) (fixes bug 711766)
- From: Arth Patel <arthpatel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calculator] Fix precision loss of ln(e^1) (fixes bug 711766)
- Date: Mon, 24 Feb 2014 16:52:53 +0000 (UTC)
commit e1ba299acfe4cf6631de4d457b9451471171ee39
Author: Daniel Renninghoff <daniel danielrenninghoff com>
Date: Sun Feb 23 21:33:39 2014 +0100
Fix precision loss of ln(e^1) (fixes bug 711766)
ln(e^1) calculated slightly more than 1, which means that some things were broken,
for example e^(i pi).
https://bugzilla.gnome.org/show_bug.cgi?id=711766
src/number.vala | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/src/number.vala b/src/number.vala
index 832a53a..6db386e 100644
--- a/src/number.vala
+++ b/src/number.vala
@@ -2086,6 +2086,10 @@ public class Number
private Number ln_real ()
{
+ // ln(e^1) = 1, fixes precision loss
+ if (equals (new Number.eulers ()))
+ return new Number.integer (1);
+
/* LOOP TO GET APPROXIMATE Ln (X) USING SINGLE-PRECISION */
var t1 = copy ();
var z = new Number.integer (0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]