[LON-CAPA-cvs] cvs: loncom /homework/templates CustomResponse.problem
www
www@source.lon-capa.org
Thu, 10 Jun 2010 22:37:13 -0000
www Thu Jun 10 22:37:13 2010 EDT
Modified files:
/loncom/homework/templates CustomResponse.problem
Log:
Recognize negative and floating point numbers
Index: loncom/homework/templates/CustomResponse.problem
diff -u loncom/homework/templates/CustomResponse.problem:1.3 loncom/homework/templates/CustomResponse.problem:1.4
--- loncom/homework/templates/CustomResponse.problem:1.3 Mon Jul 6 17:12:47 2009
+++ loncom/homework/templates/CustomResponse.problem Thu Jun 10 22:37:12 2010
@@ -11,7 +11,7 @@
# No units needed
if ($submission=~/^\d+\s+\w+$/) { return 'UNIT_NOTNEEDED'; }
# Need a numerical answer here
-if ($submission!~/^\d+$/) { return 'WANTED_NUMERIC'; }
+if ($submission!~/^[\d\.\-]+$/) { return 'WANTED_NUMERIC'; }
$difference=abs(90-abs($submission));
if ($difference==0) { return 'EXACT_ANS'; }
if ($difference < 0.001) { return 'APPROX_ANS'; }