
15 Mar
2005
15 Mar
'05
1:43 p.m.
"Andy Little" <andy@servocomm.freeserve.co.uk> wrote With this operator in place it is also possible
to 'reduce' rationals to integers where possible and further to keep integral constants as integral types by default, knowing that conversion will be automatic if a fraction is required to prevent loss of precision.
To automatically 'reduce' a rational_c to an integral_c where its denominator is 1 was not sound. In practise the two types are not equivalent due to their different behaviour in division. Obvious really. The obvious and safe scheme involves using the mpl::operator::divides and always 'promoting' to a rational_c in any mixed arithmetic. regards Andy Little