Reformulated q & r to prevent fp overflows