Código VB.NET:¿Por qué este código devuelve valores diferentes? (C# y VB.NET)
Module Module1
Sub Main()
Dim x, y As Single
x = 0 + (512/2 - 407)/256 * 192 * -1
y = 0 + (512/2 - 474)/256 * 192
Console.WriteLine(x.ToString + ": " + y.ToString)
Console.ReadLine()
End Sub
End Module
Devuelve: 113,25: -163,5
C# Código:
class Program
{
static void Main(string[] args)
{
float x, y;
x = 0 + (512/2 - 407)/256 * 192 * -1;
y = 0 + (512/2 - 474)/256 * 192;
Console.WriteLine(x + ": " + y);
Console.ReadLine();
}
}
devuelve 0: 0
No lo entiendo, agradecería una explicación.
Gracias por su ayuda. – tryingit
¡Eres bienvenido! –