performance - Can I improve the "double.IsNaN( x )" function call on embedded C#? -


I have a line of code called "code" for loop millions of times, checking if any If the argument passed is double.NaN . I have certified my application and one of the obstacles is this simple task:

  Public Zero DoSomething (double [] args) {for (int i = 0; i & lt; args .length; I ++) {if (double.IsNan (args [i])} {// do something}}} Can I customize it even if i can not convert the code inside  if ? 

If you have really optimized other parts of your code, then let's do this function a little bit. Secret does not use the definition of a number (nan):

"selfless x! = Y is true, but all other, x

> Translate into your code you will get:

  Public Zero DoSomething (double [] args) {for (int i = 0; i & lt; args.Length; i ++) {double Value = args [ii]; Aug (Value! = Value) {// do something}}}  

NanUs in an ARM device, using approximately .NET compact framework 3.5, approximately 50% chance of receiving value ! = Value doubly doubled as double.Insn (Value)

Just after your Measure Be sure to execute your application!


Comments