# get the fractional portion of a number sub frac { $_[0]-int($_[0]) } # find the remainder in a real division sub rem { $_[1]*frac($_[0]/$_[1]) }