Merge lp:~trojan295/pantheon-calculator/bugfix-1415054 into lp:~elementary-apps/pantheon-calculator/trunk

Proposed by Damian Czaja
Status: Merged
Approved by: xapantu
Approved revision: 128
Merged at revision: 158
Proposed branch: lp:~trojan295/pantheon-calculator/bugfix-1415054
Merge into: lp:~elementary-apps/pantheon-calculator/trunk
Diff against target: 22 lines (+3/-2)
1 file modified
src/Core/Evaluation.vala (+3/-2)
To merge this branch: bzr merge lp:~trojan295/pantheon-calculator/bugfix-1415054
Reviewer Review Type Date Requested Status
xapantu (community) Approve
Review via email: mp+255181@code.launchpad.net

Commit message

Added the Euler constant.

Description of the change

Added the Euler constant.

The 'e' symbol was used in scientific notation. I changed it to uppercase 'E' and the lowercase 'e' is now the Euler constant.

To post a comment you must log in.
Revision history for this message
xapantu (xapantu) wrote :

Thanks for your patch, it works fine :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Core/Evaluation.vala'
2--- src/Core/Evaluation.vala 2015-02-09 19:41:46 +0000
3+++ src/Core/Evaluation.vala 2015-04-03 12:10:43 +0000
4@@ -54,7 +54,7 @@
5 Operator () { symbol = "÷", inputs = 2, prec = 2, fixity = "LEFT", eval = (a, b) => { return a / b; } },
6 Operator () { symbol = "mod", inputs = 2, prec = 2, fixity = "LEFT", eval = (a, b) => { return a % b; } },
7 Operator () { symbol = "^", inputs = 2, prec = 3, fixity = "RIGHT", eval = (a, b) => { return Math.pow (a, b); } },
8- Operator () { symbol = "e", inputs = 2, prec = 4, fixity = "RIGHT", eval = (a, b) => { return a*Math.pow (10, b); } },
9+ Operator () { symbol = "E", inputs = 2, prec = 4, fixity = "RIGHT", eval = (a, b) => { return a*Math.pow (10, b); } },
10 Operator () { symbol = "%", inputs = 1, prec = 5, fixity = "LEFT", eval = (a, b) => { return b / 100.0;} } };
11
12 private struct Function { string symbol; int inputs; Eval eval;}
13@@ -71,7 +71,8 @@
14
15 private struct Constant { string symbol; Eval eval; }
16 private Constant[] constants = { Constant () { symbol = "pi", eval = () => { return Math.PI; } },
17- Constant () { symbol = "π", eval = () => { return Math.PI; } } };
18+ Constant () { symbol = "π", eval = () => { return Math.PI; } },
19+ Constant () { symbol = "e", eval = () => { return Math.E; } } };
20
21 public static string evaluate (string str, int d_places) throws OUT_ERROR {
22 try {

Subscribers

People subscribed via source and target branches

to all changes: