我看到一些像这样的代码:
float num2 = ( ( this.X * this.X ) + ( this.Y * this.Y ) ) + ( this.Z * this.Z );
float num = 1f / ( ( float ) Math.Sqrt ( ( double ) num2 ) );
this.X *= num;
this.Y *= num;
this.Z *= num;
如果是这样,会有什么影响吗?
float num2 = ( ( this.X * this.X ) + ( this.Y * this.Y ) ) + ( this.Z * this.Z );
float num = 1 / ( ( float ) Math.Sqrt ( ( double ) num2 ) );
this.X *= num;
this.Y *= num;
this.Z *= num;
编译器会使用 (float) / (float)
还是尝试使用 (double) / (float)
来处理第二个例子的第2行?
编辑:顺便问一下,这样做会有任何性能差异吗?