I'm a total beginner. I've just made a small C# program on SharpDevelop that simply calculates the square root of the first few integers. Here it is:
public static void Main(string[] args)
{
int i;
XXXXX[] t = new XXXXX[40];
for(i=0; i<t.Length; i++)
{
t[i]=Math.Sqrt(i);
}
for(i=0; i<t.Length; i++)
{
Console.WriteLine(""+t[i]);
}
Console.ReadKey(true);
}
My question is:
Why does my program work when I write "double" instead of the "XXXXX" but doesn't work when I write "float" instead of the "XXXXX" ?
I thought I heard my teacher say that float and double are similar, except that double has more precision. So I don't understand why I can't use float instead of double...