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

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 31 Mar 2005 17:12:38 -0000


albertel		Thu Mar 31 12:12:38 2005 EDT

  Modified files:              
    /loncom/homework	default_homework.lcpm 
  Log:
  - &format('60','2S'); works correctly now BUG#4028
  
  
Index: loncom/homework/default_homework.lcpm
diff -u loncom/homework/default_homework.lcpm:1.97 loncom/homework/default_homework.lcpm:1.98
--- loncom/homework/default_homework.lcpm:1.97	Thu Mar 31 09:43:13 2005
+++ loncom/homework/default_homework.lcpm	Thu Mar 31 12:12:37 2005
@@ -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.97 2005/03/31 14:43:13 albertel Exp $
+# $Id: default_homework.lcpm,v 1.98 2005/03/31 17:12:37 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -680,6 +680,11 @@
     my $numSig = $xint*10**($x10-$sig+$power);
     # insert trailing zero's if have decimal point
     $numSig =~ s/^(\d+)\.(\d+)(\e?(.*)?)$/$1\.$2$zeros$3/;
+    # put a decimal pt for number ending with 0 and length = # of sig fig
+    $numSig.='.' if (length($numSig) == $sig && $numSig =~ /0$/);
+    if (length($numSig) < $sig) {
+	$numSig.='.'.substr($zeros,0,($sig-length($numSig)));
+    }
     # return number with sign
     return $sign.$numSig;