Diff for /loncom/homework/default_homework.lcpm between versions 1.86 and 1.88

version 1.86, 2004/06/09 21:08:21 version 1.88, 2004/10/05 20:18:29
Line 41  sub caparesponse_check { Line 41  sub caparesponse_check {
     my $type=$LONCAPA::CAPAresponse_args{'type'};      my $type=$LONCAPA::CAPAresponse_args{'type'};
     my $tol=$LONCAPA::CAPAresponse_args{'tol'};      my $tol=$LONCAPA::CAPAresponse_args{'tol'};
     my $sig=$LONCAPA::CAPAresponse_args{'sig'};      my $sig=$LONCAPA::CAPAresponse_args{'sig'};
     my $ans_fmt=$LONCAPA::CAPAresponse_args{'ans_fmt'};      my $ans_fmt=$LONCAPA::CAPAresponse_args{'format'};
     my $unit=$LONCAPA::CAPAresponse_args{'unit'};      my $unit=$LONCAPA::CAPAresponse_args{'unit'};
     my $calc=$LONCAPA::CAPAresponse_args{'calc'};      my $calc=$LONCAPA::CAPAresponse_args{'calc'};
     my $samples=$LONCAPA::CAPAresponse_args{'samples'};      my $samples=$LONCAPA::CAPAresponse_args{'samples'};
Line 70  sub caparesponse_check { Line 70  sub caparesponse_check {
  $response=~s/ +/ /g;   $response=~s/ +/ /g;
     }      }
     if ($type eq 'float') { $response=~s/,//g; }      if ($type eq 'float') { $response=~s/,//g; }
       &LONCAPA_INTERNAL_DEBUG("fmt $ans_fmt, res is $response");
       if ($type eq 'float' && $ans_fmt=~/\$/) {
    if ($response!~/^\$/)  { return "NO_UNIT: Missing \$ "; }
    $response=~s/\$//g;
       }
       $ans_fmt=~s/\W//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 344  sub random_multivariate_normal { Line 351  sub random_multivariate_normal {
     my ($item_cnt,$seed,$mean,$covar) = @_;      my ($item_cnt,$seed,$mean,$covar) = @_;
     my @oldseed=&random_get_seed();      my @oldseed=&random_get_seed();
     &random_set_seed_from_phrase($seed);      &random_set_seed_from_phrase($seed);
     @retArray=&math_random_multivariate_normal($item_cnt,@$mean,@$covar);      my @retArray=&math_random_multivariate_normal($item_cnt,@$mean,@$covar);
     &random_set_seed(@oldseed);      &random_set_seed(@oldseed);
     return @retArray;      return @retArray;
 }  }
Line 354  sub random_multinomial { Line 361  sub random_multinomial {
     my @oldseed=&random_get_seed();      my @oldseed=&random_get_seed();
     my @retArray;      my @retArray;
     &random_set_seed_from_phrase($seed);      &random_set_seed_from_phrase($seed);
     @retArray=&math_random_multinomial($item_cnt,@p);      my @retArray=&math_random_multinomial($item_cnt,@p);
     &random_set_seed(@oldseed);      &random_set_seed(@oldseed);
     return @retArray;      return @retArray;
 }  }
Line 523  sub chemparse { Line 530  sub chemparse {
  $formula .= $molecule.' ';   $formula .= $molecule.' ';
     }      }
     # get rid of trailing space      # get rid of trailing space
     $formula =~ s/(\Q${nbsp}\E| )$//;      $formula =~ s/(\&nbsp\;| )$//;
           
     return &xmlparse($formula);      return &xmlparse($formula);
 }  }
   
 sub prettyprint {  sub prettyprint {
     my ($value,$fmt,$target)=@_;      my ($value,$fmt,$target)=@_;
       &LONCAPA_INTERNAL_DEBUG("format -$fmt-");
     my $result;      my $result;
     if (!$target) { $target = $external::target; }      if (!$target) { $target = $external::target; }
     if ($fmt =~ /chem/i) { return(&chemparse($value)); }      if ($fmt =~ /chem/i) { return(&chemparse($value)); }

Removed from v.1.86  
changed lines
  Added in v.1.88


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>