As you may be doing to get percents, try using contextPercent.pl (https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/macros/PCC/contextPercent.pl). Make $ans a percent object, but set the flags so that decimals and fractions are acceptable answers too. I think that's the default. That is, I think if $ans=Percent("50%"), a student can type 50%, 0.5, or 1/2 and be marked correct.
Then, to manipulate how to display the correct answer use the correct_ans_latex_string option when calling the answer checker. For example:
If you have $fractionanswer dynamically created as a MathObject Fraction, then I think this would work:
So in summary, and completely untested:
$realanswer = 0.5;
$fractionanswer = Fraction($realanswer);
$ans = Percent($realanswer);