[Mono-devel-list] Compiler Bug

yoros at wanadoo.es yoros at wanadoo.es
Sun Mar 23 02:09:19 EST 2003


Hello,

I have found a bug in the compiler for the attached code.

When there is a "casting" in a foreach loop, the values are wrong
converted (at least, from double to float).

It is a bug in the compiler because the executable file does the same in
MS.NET and an executable generated in MS.NET works right in MONO.

Is filed yet this bug?

I can make a test and add it in tests directory for mcs...

See you,

    Pedro

-- 
Pedro Martinez Juliá
\  yoros at terra.es
)|    yoros at wanadoo.es
/        http://yoros.cjb.net
Socio HispaLinux #311
Usuario Linux #275438 - http://counter.li.org
GnuPG public information:  pub  1024D/74F1D3AC
Key fingerprint = 8431 7B47 D2B4 5A46 5F8E  534F 588B E285 74F1 D3AC
-------------- next part --------------
using System;


public class DoubleToFloatForeach {

	public static void Main (string[] args) {

		double[] values = {123, 1234567890, 1.2, 0.086, 86000, 123456, 1234,
			-1234, 12345678901234567890.1234567890};
		int i = 0;
		foreach (float v1 in values) {
			float v2 = (float)values[i++];
			if (v2 != v1) {
				Console.WriteLine(v2 + " ::: " + v1);
			}
		}

	}

}


More information about the Mono-devel-list mailing list