[Mono-bugs] [Bug 444678] New: Unary minus works incorrectly for local float constant with "f" suffix
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Thu Nov 13 10:51:46 EST 2008
https://bugzilla.novell.com/show_bug.cgi?id=444678
Summary: Unary minus works incorrectly for local float constant
with "f" suffix
Product: Mono: Compilers
Version: 2.0
Platform: Macintosh
OS/Version: Mac OS X 10.4
Status: NEW
Severity: Minor
Priority: P5 - None
Component: C#
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: the.real.andeeee at googlemail.com
QAContact: mono-bugs at lists.ximian.com
Found By: Other
Under mcs/gmcs 2.0.1.0, the value of a local float constant appears to change
if the constant is used with a unary minus in an expression anywhere in the
code. For example:-
using System;
public class ConstTest {
public static void Main() {
const float num = 2f;
Console.WriteLine("{0}, {1}", num, -num);
}
}
I would expect this code to output "2, -2", but I actually get "-2, -2". It is
as if the value of the constant changes when a unary minus is applied anywhere
within the constant's scope. I have found the same result with graphical code
that doesn't use Console.WriteLine or any other string formatting routine - it
definitely seems to be the value itself that is incorrect.
Strangely, the problem does not occur for doubles or ints or non-constant
floats, and it only happens when the "f" suffix is used at the end of the float
literal. Also, it only seems to affect constants declared locally within a
function; those declared in the main body of the class work as expected.
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list