If you load contextFraction.pl, then there is a Fraction Context with a Math Object Fraction that automatically reduces fractions (this is a flag that can be toggled.)
$fraction = Fraction($numer,$denom);
I find it useful to then return to the Numeric Context
$fraction = Compute("$fraction");
Or students might get error messages implying they should be entering a fraction, even when $fraction is actually a whole number.
Read more about the flags for Context("Fraction") here.
If you have a Fraction Math Object and wish to extract the reduced numerator or denominator, first create an array from $f:
@g = $f->value;
And then $g is the numerator and $g is the denominator. These are perl integers, not Math Objects, so you might want to set something like
$num = Compute($g);
WeBWorK Main Forum
mod (%) irregularities ?
This forum has a limit to the number of forum postings you can make in a given time period - this is currently set at 10 posting(s) in 1 day