version 1.152.2.3, 2012/11/22 02:15:42
|
version 1.159, 2011/06/09 15:43:56
|
Line 253 sub caparesponse_check {
|
Line 253 sub caparesponse_check {
|
elsif ($result =='15') { $result='UNIT_IRRECONCIBLE'; } |
elsif ($result =='15') { $result='UNIT_IRRECONCIBLE'; } |
else {$result = "ERROR: Unknown Result:$result:$@:";} |
else {$result = "ERROR: Unknown Result:$result:$@:";} |
|
|
# &LONCAPA_INTERNAL_DEBUG("RetError $reterror: Answer $answer: Response $response: type-$type|$tol|$tol_type|$sig:$sig_lbound:$sig_ubound|$unit|"); |
|
# &LONCAPA_INTERNAL_DEBUG(" $answer $response $result "); |
|
return ($result,$reterror); |
return ($result,$reterror); |
} |
} |
|
|
Line 265 sub caparesponse_check_list {
|
Line 263 sub caparesponse_check_list {
|
my $type = $LONCAPA::CAPAresponse_args{'type'}; |
my $type = $LONCAPA::CAPAresponse_args{'type'}; |
my $answerunit=$LONCAPA::CAPAresponse_args{'unit'}; |
my $answerunit=$LONCAPA::CAPAresponse_args{'unit'}; |
&LONCAPA_INTERNAL_DEBUG("Got type :$type: answer unit :$answerunit:\n"); |
&LONCAPA_INTERNAL_DEBUG("Got type :$type: answer unit :$answerunit:\n"); |
|
|
my $preprocess=$LONCAPA::CAPAresponse_args{'preprocess'}; |
my $preprocess=$LONCAPA::CAPAresponse_args{'preprocess'}; |
$preprocess=~s/^\&//; |
$preprocess=~s/^\&//; |
|
|
Line 309 sub caparesponse_check_list {
|
Line 307 sub caparesponse_check_list {
|
my ($allowalgebra)=($LONCAPA::CAPAresponse_args{'allowalgebra'}=~/^(yes|1|on)$/i); |
my ($allowalgebra)=($LONCAPA::CAPAresponse_args{'allowalgebra'}=~/^(yes|1|on)$/i); |
if ($type eq 'float' || $type eq '') { |
if ($type eq 'float' || $type eq '') { |
#for numerical problems split off the unit |
#for numerical problems split off the unit |
my ($part1,$part2); |
my $part1; |
|
my $part2; |
if ($allowalgebra) { |
if ($allowalgebra) { |
($part1,$part2)=($responses->[0][-1]=~ /^(.*[^\s])\s+([^\s]+)$/); |
($part1,$part2)=($responses->[0][-1]=~ /^(.*[^\s])\s+([^\s]+)$/); |
} else { |
} else { |
($part1,$part2)=($responses->[0][-1]=~ /^([\d\.\,\s\$]*(?:(?:[xX\*]10[\^\*]*|[eE]*)[\+\-]*\d*)*(?:^|\S)\d+)([\$\s\w\^\*\/\(\)\+\-]*[^\d\.\s\,][\$\s\w\^\*\/\(\)\+\-]*)$/); |
($part1,$part2)=($responses->[0][-1]=~ /^([\d\.\,\s\$]*(?:(?:[xX\*]10[\^\*]*|[eE]*)[\+\-]*\d*)*(?:^|\S)\d+)([\$\s\w\^\*\/\(\)\+\-]*[^\d\.\s\,][\$\s\w\^\*\/\(\)\+\-]*)$/); |
} |
} |
Line 319 sub caparesponse_check_list {
|
Line 318 sub caparesponse_check_list {
|
$responses->[0][-1]=$part1; |
$responses->[0][-1]=$part1; |
$unit=&capa_formula_fix($part2); |
$unit=&capa_formula_fix($part2); |
my $customunits=$LONCAPA::CAPAresponse_args{'customunits'}; |
my $customunits=$LONCAPA::CAPAresponse_args{'customunits'}; |
if ($customunits =~ /\S/) { |
foreach my $replacement (split(/\s*\,\s*/,$customunits)) { |
foreach my $replacement (split(/\s*\,\s*/,$customunits)) { |
my ($which,$what)=split(/\s*\=\s*/,$replacement); |
my ($which,$what)=split(/\s*\=\s*/,$replacement); |
if ((defined($which)) && (defined($what))) { |
if ((defined($which)) && (defined($what))) { |
$what=&capa_formula_fix($what); |
$what=&capa_formula_fix($what); |
$unit=~s/$which/\($what\)/g; |
$unit=~s/$which/\($what\)/g; |
|
} |
|
} |
} |
} |
} |
} |
} |
Line 360 sub caparesponse_check_list {
|
Line 357 sub caparesponse_check_list {
|
$appendunit='%'.$appendunit; |
$appendunit='%'.$appendunit; |
} |
} |
# Zero does not need a dimension |
# Zero does not need a dimension |
if (($element =~ /^[0\.]+$/) && ($unit!~/\w/) && ($answerunit=~/\w/)) { |
if (($element==0) && ($unit!~/\w/) && ($answerunit=~/\w/)) { |
$appendunit=$answerunit; |
$appendunit=$answerunit; |
} |
} |
# Do the math for the student if allowed |
# Do the math for the student if allowed |
Line 817 sub cos { CORE::cos(shift) }
|
Line 814 sub cos { CORE::cos(shift) }
|
sub exp { CORE::exp(shift) } |
sub exp { CORE::exp(shift) } |
sub int { CORE::int(shift) } |
sub int { CORE::int(shift) } |
sub log { CORE::log(shift) } |
sub log { CORE::log(shift) } |
sub ln { CORE::log(shift) } |
|
sub atan2 { CORE::atan2($_[0],$_[1]) } |
sub atan2 { CORE::atan2($_[0],$_[1]) } |
sub sqrt { CORE::sqrt(shift) } |
sub sqrt { CORE::sqrt(shift) } |
|
|
Line 1184 sub middlename {
|
Line 1180 sub middlename {
|
$middlename = '' if $middlename eq ""; |
$middlename = '' if $middlename eq ""; |
return $middlename; |
return $middlename; |
} |
} |
|
|
|
|
sub lastname { |
sub lastname { |
my $lastname = &EXT('environment.lastname'); |
my $lastname = &EXT('environment.lastname'); |