From: dpvc v. a. <we...@ma...> - 2005-12-01 13:20:10
|
Log Message: ----------- Fixed a problem with not including parentheses when a negative number is the base of a power. (And in general, when a negative is used as an operand of a higher-precendence operation, but it really only affected powers.) Modified Files: -------------- pg/lib/Parser: Number.pm Revision Data ------------- Index: Number.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Parser/Number.pm,v retrieving revision 1.11 retrieving revision 1.12 diff -Llib/Parser/Number.pm -Llib/Parser/Number.pm -u -r1.11 -r1.12 --- lib/Parser/Number.pm +++ lib/Parser/Number.pm @@ -68,7 +68,12 @@ my $self = shift; Value::Real->make($self->{value})->TeX($self->{equation},@_); } -sub perl {shift->{value}} +sub perl { + my $self = shift; my $parens = shift; + my $n = $self->{value}; + $n = '('.$n.')' if $parens && $n < 0; + return $n; +} ########################################### |