On 2011-08-07 03:19, bearophile wrote:
I have discussed about this topic once in past, but in the meantime I have seen 
this is a quite common problem, so I think it doesn't harm to touch this topic 
again.

This is a direct D translation of the original C or C++ code:


// version #1
double foo;
if (abs(e.x - v.x)>  double.min)
     foo = (v.y - e.y) / (v.x - e.x);
else
     foo = double.max;

If D's statements were expressions instead, this could work:

const foo = if (abs(e.x - v.x)>  double.min)
    (v.y - e.y) / (v.x - e.x);
else
    double.max;

--
/Jacob Carlborg

Reply via email to