| … | |
… | |
| 75 | if (defined $ans->{student_value}) { |
75 | if (defined $ans->{student_value}) { |
| 76 | $ans->{student_value} = Value::Formula->new($ans->{student_value}) |
76 | $ans->{student_value} = Value::Formula->new($ans->{student_value}) |
| 77 | unless Value::isValue($ans->{student_value}); |
77 | unless Value::isValue($ans->{student_value}); |
| 78 | $ans->{preview_latex_string} = $ans->{student_formula}->TeX; |
78 | $ans->{preview_latex_string} = $ans->{student_formula}->TeX; |
| 79 | $ans->{preview_text_string} = $ans->{student_formula}->string; |
79 | $ans->{preview_text_string} = $ans->{student_formula}->string; |
| 80 | $ans->{student_ans} = $ans->{student_value}->stringify; |
80 | $ans->{student_ans} = $ans->{preview_text_string}; |
| 81 | $self->$cmp_equal($ans); |
81 | $self->$cmp_equal($ans); |
| 82 | $self->$cmp_postprocess($ans) if !$ans->{error_message}; |
82 | $self->$cmp_postprocess($ans) if !$ans->{error_message}; |
| 83 | } else { |
83 | } else { |
| 84 | $self->$cmp_error($ans); |
84 | $self->$cmp_error($ans); |
| 85 | } |
85 | } |
| … | |
… | |
| 216 | |
216 | |
| 217 | package Value::Infinity; |
217 | package Value::Infinity; |
| 218 | |
218 | |
| 219 | sub cmp_class {'a Number'}; |
219 | sub cmp_class {'a Number'}; |
| 220 | |
220 | |
| 221 | sub cmp_defaults {Value::Real->cmp_defaults}; |
|
|
| 222 | |
|
|
| 223 | sub typeMatch { |
221 | sub typeMatch { |
| 224 | my $self = shift; my $other = shift; my $ans = shift; |
222 | my $self = shift; my $other = shift; my $ans = shift; |
| 225 | return 1 unless ref($other); |
223 | return 1 unless ref($other); |
| 226 | return 0 if $other->class eq 'Formula'; |
224 | return 0 if $other->class eq 'Formula'; |
| 227 | return 1 if $other->type eq 'Number'; |
225 | return 1 if $other->type eq 'Number'; |
| … | |
… | |
| 433 | # messages. |
431 | # messages. |
| 434 | # |
432 | # |
| 435 | sub cmp_defaults {( |
433 | sub cmp_defaults {( |
| 436 | Value::List::cmp_defaults(@_), |
434 | Value::List::cmp_defaults(@_), |
| 437 | typeMatch => 'Value::Interval', |
435 | typeMatch => 'Value::Interval', |
| 438 | list_type => 'a union', |
436 | list_type => 'an interval or union', |
| 439 | entry_type => 'an interval', |
437 | entry_type => 'an interval', |
| 440 | )} |
438 | )} |
| 441 | |
439 | |
| 442 | sub cmp_equal {Value::List::cmp_equal(@_)} |
440 | sub cmp_equal {Value::List::cmp_equal(@_)} |
| 443 | |
441 | |