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

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 17 May 2004 21:15:56 -0000


albertel		Mon May 17 17:15:56 2004 EDT

  Modified files:              
    /loncom/homework	default_homework.lcpm 
  Log:
  - BUG#3013, add a period to numbers that are 0f formatted
  
  
Index: loncom/homework/default_homework.lcpm
diff -u loncom/homework/default_homework.lcpm:1.78 loncom/homework/default_homework.lcpm:1.79
--- loncom/homework/default_homework.lcpm:1.78	Mon May 17 14:26:31 2004
+++ loncom/homework/default_homework.lcpm	Mon May 17 17:15:56 2004
@@ -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.78 2004/05/17 18:26:31 albertel Exp $
+# $Id: default_homework.lcpm,v 1.79 2004/05/17 21:15:56 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -484,6 +484,7 @@
     if ($fmt =~ /^\$(.*)/) { $fmt=$1; $dollarmode=1; } 
     $fmt=~s/e/E/g;
     my $result=sprintf('%.'.$fmt,$value);
+    if ($fmt eq '0f') { $result .='.'; }
     $result=~s/(E[+-]*)0/$1/;
     if ($dollarmode) {$result=&dollarmode($result);}
     return $result;
@@ -536,6 +537,7 @@
     if ($fmt =~ /chem/i) { return(&chemparse($value)); }
     if ($fmt =~ /^\$(.*)/) { $fmt=$1; $dollarmode=1; } 
     if ($fmt) { $value=sprintf('%.'.$fmt,$value); }
+    if ($fmt eq '0f') {	$value .='.'; }
     if ($value =~ /([0-9\.\-\+]+)E([0-9\-\+]+)/i ) {
 	my $frac=$1;
 	if ($dollarmode) { $frac=&dollarformat($frac); }