From: dpvc v. a. <we...@ma...> - 2008-09-18 12:29:01
|
Log Message: ----------- Fix problem with using value method on an undefined value when the point returned by the graphed funciton is undefined. Tags: ---- rel-2-4-patches Modified Files: -------------- pg/macros: PGgraphmacros.pl Revision Data ------------- Index: PGgraphmacros.pl =================================================================== RCS file: /webwork/cvs/system/pg/macros/PGgraphmacros.pl,v retrieving revision 1.6.6.1.2.1 retrieving revision 1.6.6.1.2.2 diff -Lmacros/PGgraphmacros.pl -Lmacros/PGgraphmacros.pl -u -r1.6.6.1.2.1 -r1.6.6.1.2.2 --- macros/PGgraphmacros.pl +++ macros/PGgraphmacros.pl @@ -323,9 +323,13 @@ my $localContext= Parser::Context->current(\%main::context)->copy; $localContext->variables->add($var=>'Real') unless $localContext->variables->get($var); my $formula = Value->Package("Formula()")->new($localContext,$rule); - my $subRef = sub {my $x=shift; Parser::Evaluate($formula, $var=>$x)->value}; - #traps errors when - # graph domain is larger than the function's domain. + my $subRef = sub { + my $x = shift; + my $y = Parser::Evaluate($formula, $var=>$x); + $y = $y->value if defined $y; + return $y + }; + # traps errors when graph domain is larger than the function's domain. #my $subRef = string_to_sub($rule,$var); my $funRef = new Fun($subRef,$graph); $funRef->color($color); |