Re: floating point divide

2012-10-11 Thread Damian
On Thursday, 11 October 2012 at 15:21:01 UTC, bearophile wrote: Damian: I come from a pascal background and we could use: divintegral division operator / floating point division operator Two operators for the two different operations is a design better than C, that is bug-prone.

Re: floating point divide

2012-10-11 Thread bearophile
Damian: I come from a pascal background and we could use: divintegral division operator / floating point division operator Two operators for the two different operations is a design better than C, that is bug-prone. So my question is, how does D force floating point division on int

Re: floating point divide

2012-10-11 Thread Aziz K.
int n1 = 10, n2 = 2; float f = (n1+0.0f)/n2; Casting n1 to float would also work, but I hope the compiler is smart enough to optimize away the plus expression.

floating point divide

2012-10-11 Thread Damian
I come from a pascal background and we could use: divintegral division operator / floating point division operator So my question is, how does D force floating point division on integrals? At the moment i do this, but i was hoping for an easier way: int n1 = 10, n2 = 2; float f = cast