I use C # with the XNA library, and I get NaNs in my Vector3 objects. Is there a way to get into the debugger when an abusive calculation occurs (e.g. division by zero)? Currently, the program continues to work. I am using VS2008 Professional. All exceptions in the Exceptions dialog box are selected in the Custom Unprocessed column.
Edit: To clarify, I can't figure out where the calculation is bad. This is why I want the debugger to crash automatically. Setting breakpoints is not a solution.
-, double/float Infinity/-Infinity , double . double/float, , NaN. .
, , . NaN, , NaN!= NaN.
double a = double.NaN; Console.Out.WriteLine(a == double.NaN); // false Console.Out.WriteLine(a == a); // false Console.Out.WriteLine(double.IsNaN(a)); // true
, - (, ). , Ctrl + alt + E, - , "when throw" (),
, , 0.
, , .....
Vector3.Normalize, .
When I'm not sure if it will be zero length, I always do now
float L = V.Length (); if (L! = 0.0) V / = L;
division by zero in Normalize should throw an exception, but it is not. Caused a lot of scratches on my head.
Source: https://habr.com/ru/post/1705682/More articles:Add XML comment during serialization / deserialization using VB.NET - vb.netwhen should I use a session template per query - databaseC ++ Symmetric binary operators with different types - c ++What is the best solution to solve the GPS problem of tracking GPS data in C #? - multithreadingIs it normal for a website to return an HTTP code of 200 for a page not found (404)? - javaDebugging messages using Flex? - flexConnecting to an OpenLDAP server in vbScript via openDSObject - vbscriptAsp.Net select in Sql - sqlHow to use CSS StyleSheet among projects? - cssUndo the latest version from Sourcesafe - version-controlAll Articles