Ccnvert to float [,]数组为double [,]数组 [英] Ccnvert to float[,] array to double[,] array
本文介绍了Ccnvert to float [,]数组为double [,]数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将浮点数组转换为双数组?
这不起作用:
float [,] resultArray2 = new float [ 354 , 354 ];
double [,] resultArray3 = new double [ 354 , 354 ];
resultArray2 = resultArray3;
解决方案
你好
< pre lang =c#> float [,] resultArray2 = new float [ 354 , 354 ];
double [,] resultArray3 = new double [ 354 , 354 ];
for ( int i = 0 ; i < resultArray2.GetLength( 0 ); i ++ )
{
for ( int j = 0 ; j < resultArray2.GetLength( 1 ); j ++)
{
resultArray3 [i,j] = resultArray2 [i,j];
}
}
public static double [] convertToDouble( float [] inputArray)
{
if (inputArray == null )
return null ;
double [] output = new 双跨度> [inputArray.length];
for ( int i = 0 ; i < inputArray.length; i ++)
output [i] = inputArray [i];
return 输出;
}
How do I convert a float array to a double array?
This does not work:
float[,] resultArray2 = new float[354, 354];
double[,] resultArray3 = new double[354, 354];
resultArray2 = resultArray3;
解决方案
Hello
float[,] resultArray2 = new float[354, 354]; double[,] resultArray3 = new double[354, 354]; for (int i = 0; i < resultArray2.GetLength(0); i++) { for (int j = 0; j < resultArray2.GetLength(1); j++) { resultArray3[i, j] = resultArray2[i, j]; } }
public static double[] convertToDouble(float[] inputArray) { if (inputArray== null) return null; double[] output = new double[inputArray.length]; for (int i = 0; i < inputArray.length; i++) output[i] = inputArray[i]; return output; }
这篇关于Ccnvert to float [,]数组为double [,]数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文