[system] / trunk / webwork / system / courseScripts / PGanswermacros.pl Repository:
ViewVC logotype

Diff of /trunk/webwork/system/courseScripts/PGanswermacros.pl

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

Revision 274 Revision 275
392 'unit' => 'units', 392 'unit' => 'units',
393 'abstol' => 'tol', 393 'abstol' => 'tol',
394 ); 394 );
395 395
396 set_default_options( \%out_options, 396 set_default_options( \%out_options,
397 'tolType' => (defined($out_options{tol}) ) ? 'absolute' : 'relative', # the existence of "tol" means that we use absolute tolerance mode 397 'tolType' => (defined($out_options{'tol'}) ) ? 'absolute' : 'relative', # the existence of "tol" means that we use absolute tolerance mode
398 'tolerance' => (defined($out_options{tol}) ) ? $numAbsTolDefault : $numRelPercentTolDefault, 398 'tolerance' => (defined($out_options{'tolType'}) && $out_options{'tolType'} eq 'absolute' ) ? $numAbsTolDefault : $numRelPercentTolDefault, # relative tolerance is the default
399 'mode' => 'std', 399 'mode' => 'std',
400 'format' => $numFormatDefault, 400 'format' => $numFormatDefault,
401 'tol' => undef, 401 'tol' => undef,
402 'relTol' => undef, 402 'relTol' => undef,
403 'units' => undef, 403 'units' => undef,
410 # can't use both units and strings 410 # can't use both units and strings
411 if( defined( $out_options{'units'} ) && defined( $out_options{'strings'} ) ) { 411 if( defined( $out_options{'units'} ) && defined( $out_options{'strings'} ) ) {
412 warn "Can't use both 'units' and 'strings' in the same problem " . 412 warn "Can't use both 'units' and 'strings' in the same problem " .
413 "(check your parameters to num_cmp() )"; 413 "(check your parameters to num_cmp() )";
414 } 414 }
415
416 # absolute tolType and relTol are incompatible. So are relative tolType and tol
417 if( defined( $out_options{'relTol'} ) && $out_options{'tolType'} eq 'absolute' ) {
418 warn "The 'tolType' 'absolute' is not compatible with 'relTol' " .
419 "(check your parameters to num_cmp() )";
420 }
421 if( defined( $out_options{'tol'} ) && $out_options{'tolType'} eq 'relative' ) {
422 warn "The 'tolType' 'relative' is not compatible with 'tol' " .
423 "(check your parameters to num_cmp() )";
424 }
425
415 426
416 # Handle legacy options 427 # Handle legacy options
417 if ($out_options{tolType} eq 'absolute') { 428 if ($out_options{tolType} eq 'absolute') {
418 $out_options{'tolerance'}=$out_options{'tol'} if defined($out_options{'tol'}); 429 $out_options{'tolerance'}=$out_options{'tol'} if defined($out_options{'tol'});
419 delete($out_options{'relTol'}) if exists( $out_options{'relTol'} ); 430 delete($out_options{'relTol'}) if exists( $out_options{'relTol'} );

Legend:
Removed from v.274  
changed lines
  Added in v.275

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9