version 1.81, 2004/05/18 23:12:15
|
version 1.85, 2004/06/04 22:56:46
|
Line 69 sub caparesponse_check {
|
Line 69 sub caparesponse_check {
|
$answer=~s/ +/ /g; |
$answer=~s/ +/ /g; |
$response=~s/ +/ /g; |
$response=~s/ +/ /g; |
} |
} |
|
if ($type eq 'float') { $response=~s/,//g; } |
if (length($response) > 500) { return "TOO_LONG: Answer too long"; } |
if (length($response) > 500) { return "TOO_LONG: Answer too long"; } |
|
|
if ($type eq '' ) { |
if ($type eq '' ) { |
Line 105 sub caparesponse_check {
|
Line 106 sub caparesponse_check {
|
} |
} |
} |
} |
|
|
if ($sig eq '') { |
($sig_ubound,$sig_lbound)=&LONCAPA_INTERNAL_get_sigrange($sig); |
$sig_lbound = 0; #SIG_LB_DEFAULT |
|
$sig_ubound =15; #SIG_UB_DEFAULT |
|
} else { |
|
($sig_lbound,$sig_ubound) = split /,/,$sig; |
|
if (!defined($sig_lbound)) { |
|
$sig_lbound = 0; #SIG_LB_DEFAULT |
|
$sig_ubound =15; #SIG_UB_DEFAULT |
|
} |
|
if (!defined($sig_ubound)) { $sig_ubound=$sig_lbound; } |
|
} |
|
my $reterror=""; |
my $reterror=""; |
my $result = &caparesponse_capa_check_answer($response,$answer,$type, |
my $result = &caparesponse_capa_check_answer($response,$answer,$type, |
$tol_type,$tol, |
$tol_type,$tol, |
Line 142 sub caparesponse_check {
|
Line 134 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:$@:";} |
|
|
return ("$result:\nRetError $reterror:\nError $error:\nAnswer $answer:\nResponse $response:\n type-$type|$tol|$tol_type|$sig:$sig_lbound:$sig_ubound|$unit|\n$message",$reterror); |
return ("$result:\nRetError $reterror:\nAnswer $answer:\nResponse $response:\n type-$type|$tol|$tol_type|$sig:$sig_lbound:$sig_ubound|$unit|\n$message",$reterror); |
} |
} |
|
|
|
|
Line 172 sub caparesponse_check_list {
|
Line 164 sub caparesponse_check_list {
|
$unit=$2; |
$unit=$2; |
} |
} |
} |
} |
$result.="Final final response :$responselist['-1']:\n"; |
$result.="Final final response :$responselist['-1']:$unit:\n"; |
$result.=":$#list: answers\n"; |
$result.=":$#list: answers\n"; |
$unit=~s/\s//; |
$unit=~s/\s//; |
my $i=0; |
my $i=0; |
Line 241 sub random {
|
Line 233 sub random {
|
if ( ! $hidden::RANDOMINIT ) { |
if ( ! $hidden::RANDOMINIT ) { |
if ($external::randomseed == 0) { $external::randomseed=1; } |
if ($external::randomseed == 0) { $external::randomseed=1; } |
if ($external::randomseed =~/,/) { |
if ($external::randomseed =~/,/) { |
my ($num1,$num2)=split(/,/,$seed); |
my ($num1,$num2)=split(/,/,$external::randomseed); |
|
&random_set_seed(1,abs($num1)); |
|
} elsif ($external::randomseed =~/:/) { |
|
my ($num1,$num2)=split(/:/,$external::randomseed); |
&random_set_seed(abs($num1),abs($num2)); |
&random_set_seed(abs($num1),abs($num2)); |
} else { |
} else { |
&random_set_seed(1,int(abs($external::randomseed))); |
&random_set_seed(1,int(abs($external::randomseed))); |
Line 484 sub format {
|
Line 479 sub format {
|
if ($fmt =~ /^([^\d]*)(.*)/) { $options=$1; $fmt=$2; } |
if ($fmt =~ /^([^\d]*)(.*)/) { $options=$1; $fmt=$2; } |
#if ($options =~ /\$/) { $dollamode=1; } |
#if ($options =~ /\$/) { $dollamode=1; } |
#if ($options =~ /,/) { $commamode=1; } |
#if ($options =~ /,/) { $commamode=1; } |
if ($options =~ /\./) { |
if ($options =~ /\./) { $alwaysperiod=1; } |
$alwaysperiod=1; |
|
&LONCAPA_INTERNAL_DEBUG("hrrm setting it to 1"); |
|
} |
|
&LONCAPA_INTERNAL_DEBUG("alwyas per $alwaysperiod opt $options fmt $fmt"); |
|
$fmt=~s/e/E/g; |
$fmt=~s/e/E/g; |
my $result=sprintf('%.'.$fmt,$value); |
my $result=sprintf('%.'.$fmt,$value); |
if ($alwaysperiod && $fmt eq '0f') { $result .='.'; } |
if ($alwaysperiod && $fmt eq '0f') { $result .='.'; } |