version 1.101, 2005/07/13 20:44:29
|
version 1.104, 2005/11/16 22:18:22
|
Line 193 sub caparesponse_check_list {
|
Line 193 sub caparesponse_check_list {
|
my $type = $LONCAPA::CAPAresponse_args{'type'}; |
my $type = $LONCAPA::CAPAresponse_args{'type'}; |
$result.="Got type :$type:\n"; |
$result.="Got type :$type:\n"; |
if ($type ne '' && $#list > 0) { |
if ($type ne '' && $#list > 0) { |
(@responselist)=split /,/,$response; |
(@responselist)=split(/,/,$response); |
} else { |
} else { |
(@responselist)=($response); |
(@responselist)=($response); |
} |
} |
Line 217 sub caparesponse_check_list {
|
Line 217 sub caparesponse_check_list {
|
$result.="trying answer :$list[$i]:\n"; |
$result.="trying answer :$list[$i]:\n"; |
my $thisanswer=$list[$i]; |
my $thisanswer=$list[$i]; |
$result.="trying answer :$thisanswer:\n"; |
$result.="trying answer :$thisanswer:\n"; |
if ($unit eq '') { |
if (defined($list[$i])) { |
($aresult,$msg)=&caparesponse_check($thisanswer,$responselist[$i]); |
if ($unit eq '') { |
|
($aresult,$msg)=&caparesponse_check($thisanswer, |
|
$responselist[$i]); |
|
} else { |
|
($aresult,$msg)=&caparesponse_check($thisanswer, |
|
$responselist[$i]." $unit"); |
|
} |
} else { |
} else { |
($aresult,$msg)=&caparesponse_check($thisanswer, |
$aresult='ERROR'; |
$responselist[$i]." $unit"); |
|
} |
} |
my ($temp)=split /:/, $aresult; |
my ($temp)=split(/:/, $aresult); |
$awards.="$temp,"; |
$awards.="$temp,"; |
$result.=$aresult; |
$result.=$aresult; |
push(@msgs,$msg); |
push(@msgs,$msg); |
} |
} |
chop $awards; |
chop($awards); |
return ("$awards:\n$result",@msgs); |
return ("$awards:\n$result",@msgs); |
} |
} |
|
|
Line 451 sub random_negative_binomial {
|
Line 456 sub random_negative_binomial {
|
return @retArray; |
return @retArray; |
} |
} |
|
|
sub abs { abs(shift) } |
sub abs { CORE::abs(shift) } |
sub sin { sin(shift) } |
sub sin { CORE::sin(shift) } |
sub cos { cos(shift) } |
sub cos { CORE::cos(shift) } |
sub exp { exp(shift) } |
sub exp { CORE::exp(shift) } |
sub int { int(shift) } |
sub int { CORE::int(shift) } |
sub log { log(shift) } |
sub log { CORE::log(shift) } |
sub atan2 { atan2($_[0],$_[1]) } |
sub atan2 { CORE::atan2($_[0],$_[1]) } |
sub sqrt { sqrt(shift) } |
sub sqrt { CORE::sqrt(shift) } |
|
|
sub tan { CORE::sin($_[0]) / CORE::cos($_[0]) } |
sub tan { CORE::sin($_[0]) / CORE::cos($_[0]) } |
#sub atan { atan2($_[0], 1); } |
#sub atan { atan2($_[0], 1); } |
Line 637 sub prettyprint {
|
Line 642 sub prettyprint {
|
sub commaformat { |
sub commaformat { |
my ($number,$target) = @_; |
my ($number,$target) = @_; |
if ($number =~ /\./) { |
if ($number =~ /\./) { |
while ($number =~ /([^\.,]+)([^\.,][^\.,][^\.,])([,0-9]*\.[0-9]*)$/) { |
while ($number =~ /([^0-9]*)([0-9]+)([^\.,][^\.,][^\.,])([,0-9]*\.[0-9]*)$/) { |
$number = $1.','.$2.$3; |
$number = $1.$2.','.$3.$4; |
} |
} |
} else { |
} else { |
while ($number =~ /([^,]+)([^,][^,][^,])([,0-9]*)$/) { |
while ($number =~ /^([^0-9]*)([0-9]+)([^,][^,][^,])([,0-9]*)$/) { |
$number = $1.','.$2.$3; |
$number = $1.$2.','.$3.$4; |
} |
} |
} |
} |
return $number; |
return $number; |