[LON-CAPA-cvs] cvs: loncom /homework default_homework.lcpm

www lon-capa-cvs@mail.lon-capa.org
Mon, 17 Jul 2006 21:11:24 -0000


www		Mon Jul 17 17:11:24 2006 EDT

  Modified files:              
    /loncom/homework	default_homework.lcpm 
  Log:
  Bug #4910: also in formula_response, 3e8 should not be turned into 3*e*8
  
  
Index: loncom/homework/default_homework.lcpm
diff -u loncom/homework/default_homework.lcpm:1.109 loncom/homework/default_homework.lcpm:1.110
--- loncom/homework/default_homework.lcpm:1.109	Wed Jul  5 15:01:44 2006
+++ loncom/homework/default_homework.lcpm	Mon Jul 17 17:11:21 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # used by lonxml::xmlparse() as input variable $safeinit to Apache::run::run()
 #
-# $Id: default_homework.lcpm,v 1.109 2006/07/05 19:01:44 albertel Exp $
+# $Id: default_homework.lcpm,v 1.110 2006/07/17 21:11:21 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -200,9 +200,13 @@
 
 sub implicit_multiplication {
     my ($expression)=@_;
-    $expression=~s/\s+/\*/g;
-    $expression=~s/(\d)([a-zA-Z\(])/$1\*$2/g;
-    $expression=~s/\)(\w)/\)\*$1/g;
+    $expression=~s/(\d+)e([\+\-]*\d+)/$1\&\($2\)/gsi;
+    $expression=~s/(\d+)(?:x|\*)10(?:\^|\*\*)([\+\-]*\d+)/$1\&\($2\)/gsi;
+    $expression=~s/\s+/\*/gs;
+    $expression=~s/(\d)([a-zA-Z\(])/$1\*$2/gs;
+    $expression=~s/([a-zA-Z])(\d)/$1\*$2/gs;
+    $expression=~s/\)(\w)/\)\*$1/gs;
+    $expression=~s/(\d+)\&\(([\+\-]*\d+)\)/$1e$2/gs;
     return $expression;
 }