Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Francis <francis@sugarlabs.org>2012-10-30 21:39:05 (GMT)
committer Daniel Francis <francis@sugarlabs.org>2012-10-30 21:39:05 (GMT)
commit4e0bbd16352a9690a45a031d1d442b0d8eb60d10 (patch)
tree5bb44ed4e781f38f4ddde6464ef4b8c8b30bfc1d
parentd454714cedd678fbf50fdcc164392769f30e2434 (diff)
Fix problems with decimal numbers. SL#4120
Here I also solve the problem with this type of expressions: -- 5x(2 --- The combination of X and a bracket. Signed-off-by: Daniel Francis <francis@sugarlabs.org>
-rw-r--r--expressions.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/expressions.py b/expressions.py
index 850ec9c..b5f8b40 100644
--- a/expressions.py
+++ b/expressions.py
@@ -40,6 +40,7 @@ def convert(expression):
expression = expression.replace('7(', '7*(')
expression = expression.replace('8(', '8*(')
expression = expression.replace('9(', '9*(')
+ expression = expression.replace('x(', 'x*(')
#Power again
expression = expression.replace('^', '**')
numbers = [str(i) for i in range(10)]
@@ -59,7 +60,7 @@ def convert(expression):
else:
on_number = True
converted_list.append(i)
- if on_number:
+ if on_number and not has_point:
converted_list.append('.0')
return ''.join(converted_list)