From: dpvc v. a. <we...@ma...> - 2008-01-16 23:03:12
|
Log Message: ----------- Make sure that real and complex values have their contexts changed if one is specified in the call to new(). Modified Files: -------------- pg/lib/Value: Complex.pm Real.pm Revision Data ------------- Index: Real.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Value/Real.pm,v retrieving revision 1.40 retrieving revision 1.41 diff -Llib/Value/Real.pm -Llib/Value/Real.pm -u -r1.40 -r1.41 --- lib/Value/Real.pm +++ lib/Value/Real.pm @@ -17,7 +17,7 @@ my $self = shift; my $class = ref($self) || $self; my $context = (Value::isContext($_[0]) ? shift : $self->context); my $x = shift; $x = [$x,@_] if scalar(@_) > 0; - return $x if Value::isReal($x); + return $x->inContext($context) if Value::isReal($x); $x = [$x] unless ref($x) eq 'ARRAY'; Value::Error("Can't convert ARRAY of length %d to %s",scalar(@{$x}),Value::showClass($self)) unless (scalar(@{$x}) == 1); Index: Complex.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Value/Complex.pm,v retrieving revision 1.35 retrieving revision 1.36 diff -Llib/Value/Complex.pm -Llib/Value/Complex.pm -u -r1.35 -r1.36 --- lib/Value/Complex.pm +++ lib/Value/Complex.pm @@ -19,7 +19,7 @@ my $self = shift; my $class = ref($self) || $self; my $context = (Value::isContext($_[0]) ? shift : $self->context); my $x = shift; $x = [$x,@_] if scalar(@_) > 0; - return $x if Value::isComplex($x) || (Value::isFormula($x) && $x->{tree}->isComplex); + return $x->inContext($context) if Value::isComplex($x) || (Value::isFormula($x) && $x->{tree}->isComplex); $x = $x->data if Value::isReal($x); $x = [$x] unless ref($x) eq 'ARRAY'; $x->[1] = 0 unless defined($x->[1]); Value::Error("Can't convert ARRAY of length %d to a Complex Number",scalar(@{$x})) |