Thank you Danny for catching that.
The below code contains a few small revisions to display the untruncated number in the text of the problem as well as in the values that the student will see in the "Entered" and "Answer Preview" columns.
DOCUMENT();
loadMacros("PGstandard.pl", "PGML.pl");
$val = 123.4012;
$ansString = sprintf("%.2f", $val);
$bleh=12;
$ans = Compute($ansString);
$ans->{correct_ans_latex_string}=$ansString;
BEGIN_PGML
Enter the number [$ansString]: [___]
END_PGML
ANS( $ans->cmp( checker=>sub {
( $correct, $student, $ansHash ) = @_;
$orig_sval=$ansHash->{original_student_ans} ;
$ansHash->{student_ans} = $orig_sval; #The "Entered" column
$ansHash->{preview_latex_string}=$orig_sval; #The "Preview" column
return ($ansHash->{original_student_ans} eq $ansString)
}
) );
ENDDOCUMENT();
The below code contains a few small revisions to display the untruncated number in the text of the problem as well as in the values that the student will see in the "Entered" and "Answer Preview" columns.
DOCUMENT();
loadMacros("PGstandard.pl", "PGML.pl");
$val = 123.4012;
$ansString = sprintf("%.2f", $val);
$bleh=12;
$ans = Compute($ansString);
$ans->{correct_ans_latex_string}=$ansString;
BEGIN_PGML
Enter the number [$ansString]: [___]
END_PGML
ANS( $ans->cmp( checker=>sub {
( $correct, $student, $ansHash ) = @_;
$orig_sval=$ansHash->{original_student_ans} ;
$ansHash->{student_ans} = $orig_sval; #The "Entered" column
$ansHash->{preview_latex_string}=$orig_sval; #The "Preview" column
return ($ansHash->{original_student_ans} eq $ansString)
}
) );
ENDDOCUMENT();