Main Site Documentation

System.Exception - CLR_E_DIVIDE_BY_ZERO occurs when dividing two doubles


#1

I’m running the following code on the FEZ Panda II:


uint total = foo(); //Can return 0
uint highTotal = bar(); //Can also return 0

double p = (double)highTotal / (double)total; //Throws an exception when both are 0, instead of setting p to Double.NaN

Do I have to turn on the NaN behaviour?


#2

I do not think this is implemented in NETMF. If you see the use then then this should be requested directly from Microsoft www.netmf.com


#3

Why would this not be implemented? Isn’t NaN upon division by zero part of the IEEE floating point spec?


#4

Why mightnt something be implemented in the micro framework? Usually to keep code size down, to give more useful functions the extra code space. Micro framework is a set of tradeoffs, some of them particular people would argue whether they’re correct; as Gus said you can go request that over on the official site.