[system] / trunk / pg / lib / Parser / Legacy / PGcomplexmacros.pl Repository:
ViewVC logotype

Diff of /trunk/pg/lib/Parser/Legacy/PGcomplexmacros.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 4927 Revision 4928
130 $cplx_params{'tolerance'} = .01*$cplx_params{'relTol'}; 130 $cplx_params{'tolerance'} = .01*$cplx_params{'relTol'};
131 } 131 }
132 132
133 my $context = $cplx_context{$mode}; 133 my $context = $cplx_context{$mode};
134 unless ($context) {$context = "Complex"; warn "Unknown mode '$mode'"} 134 unless ($context) {$context = "Complex"; warn "Unknown mode '$mode'"}
135 $context = $Parser::Context::Default::context{$context}->copy; 135 $context = Parser::Context->getCopy(\%main::context,$context);
136 136
137 # 137 #
138 # Set the format for the context 138 # Set the format for the context
139 # 139 #
140 $context->{format}{number} = $cplx_params{'format'} if $cplx_params{'format'}; 140 $context->{format}{number} = $cplx_params{'format'} if $cplx_params{'format'};
395 $permitted_error_Re = $rh_ans->{tolerance}; 395 $permitted_error_Re = $rh_ans->{tolerance};
396 $permitted_error_Im = $rh_ans->{tolerance}; 396 $permitted_error_Im = $rh_ans->{tolerance};
397 } 397 }
398 elsif ( abs($rh_ans->{correct_ans}) <= $options{zeroLevel}) { 398 elsif ( abs($rh_ans->{correct_ans}) <= $options{zeroLevel}) {
399 $permitted_error_Re = $options{zeroLevelTol}; ## want $tol to be non zero 399 $permitted_error_Re = $options{zeroLevelTol}; ## want $tol to be non zero
400 $permitted_error_Im = $options{zeroLevelTol}; ## want $tol to be non zero 400 $permitted_error_Im = $options{zeroLevelTol}; ## want $tol to be non zero
401 } 401 }
402 else { 402 else {
403 $permitted_error_Re = abs($rh_ans->{tolerance}*$rh_ans->{correct_ans}->Complex::Re); 403 $permitted_error_Re = abs($rh_ans->{tolerance}*$rh_ans->{correct_ans}->Complex::Re);
404 $permitted_error_Im = abs($rh_ans->{tolerance}*$rh_ans->{correct_ans}->Complex::Im); 404 $permitted_error_Im = abs($rh_ans->{tolerance}*$rh_ans->{correct_ans}->Complex::Im);
405
406 } 405 }
407 406
408 $rh_ans->{score} = 1 if ( abs( $rh_ans->{correct_ans}->Complex::Re - $inVal->Complex::Re) <= 407 $rh_ans->{score} = 1 if ( abs( $rh_ans->{correct_ans}->Complex::Re - $inVal->Complex::Re) <=
409 $permitted_error_Re && abs($rh_ans->{correct_ans}->Complex::Im - $inVal->Complex::Im )<= $permitted_error_Im ); 408 $permitted_error_Re && abs($rh_ans->{correct_ans}->Complex::Im - $inVal->Complex::Im )<= $permitted_error_Im );
410 409

Legend:
Removed from v.4927  
changed lines
  Added in v.4928

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9