Encontrar NaN em um array

Published by SyntaxGardener in

Retorne o índice do único valor double.NaN em um array, ou -1 se nenhum NaN ocorrer.

Exemplos

Program.FindNaN(new[] { 1.0, 2.0, double.NaN }) ➞ 2

Program.FindNaN(new[] { double.NaN, 1.0, 2.0 }) ➞ 0

Program.FindNaN(new[] { 0.0, 1.0, 2.0 }) ➞ -1