ANS(Compute($ans)->with(tolType=>'absolute', tolerance=>1E-5)->cmp);should do the trick. Also, you don't need the quotes around
$ansas they are essentially redundant (there is only a difference if $ans is undefined).
You might also find the macros in PGinfo.pl to be helpful. See the documentation for this file for details.