|
|
|
|
|
by lamontcg
931 days ago
|
|
FWIW, I tend to write a lot of error checking code that checks for division by zero ahead of time and just returns zero instead. Found an example: public double magnitude
{
get
{
double c = max_magnitude;
return c > 0 ? Math.Max(c, c * (this / c)._internal_magnitude) : 0;
}
}
I could delete quite a few if statements in pretty hot codepaths if division by zero just returned zero. |
|