[Mono-devel-list] can anyone help System.Decimal?

Daniel Morgan danielmorgan at verizon.net
Mon Apr 12 01:14:27 EDT 2004


It appears to be with both System.Decimal and
System.Data.SqlTypes.SqlDecimal.

It Decimal and SqlDecimal "remembesr" the originally parsed string.
However, Mono appears "not to remember" the originally parsed string.
I am just guessing...

Observe on .NET:

using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;

public class TestDecimal
{
	public static void Main()
	{
		string d = decimal.Parse("250.00").ToString();
		Console.WriteLine("decimal: " + d);

		string sd = SqlDecimal.Parse("250.00").ToString();
		Console.WriteLine("SqlDecimal: " + sd);

		decimal d2 = decimal.Parse("250.00");
		string sd2 = d2.ToString();
		Console.WriteLine("sd2: " + sd2);

		SqlDecimal d3 = SqlDecimal.Parse("250.00");
		string sd3 = d3.ToString();
		Console.WriteLine("sd3: " + sd3);


	}
}

E:\cygwin\home\danmorg>TestDecimal.exe
decimal: 250.00
SqlDecimal: 250.00
sd2: 250.00
sd3: 250.00

using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;

public class TestDecimal
{
	public static void Main()
	{
		string d = decimal.Parse("250.0").ToString();
		Console.WriteLine("decimal: " + d);

		string sd = SqlDecimal.Parse("250.0").ToString();
		Console.WriteLine("SqlDecimal: " + sd);

		decimal d2 = decimal.Parse("250.0");
		string sd2 = d2.ToString();
		Console.WriteLine("sd2: " + sd2);

		SqlDecimal d3 = SqlDecimal.Parse("250.0");
		string sd3 = d3.ToString();
		Console.WriteLine("sd3: " + sd3);


	}
}

E:\cygwin\home\danmorg>TestDecimal.exe
decimal: 250.0
SqlDecimal: 250.0
sd2: 250.0
sd3: 250.0

On Mono 0.31 Win32 using the same source above:


E:\cygwin\home\danmorg>mcs.bat TestDecimal.cs /r:System.Data
Compilation succeeded

E:\cygwin\home\danmorg>mono TestDecimal.exe
decimal: 250
SqlDecimal: 250
sd2: 250
sd3: 250




-----Original Message-----
From: mono-devel-list-admin at lists.ximian.com
[mailto:mono-devel-list-admin at lists.ximian.com]On Behalf Of Atsushi Eno
Sent: Monday, April 12, 2004 12:34 AM
To: mono-devel mailing list
Subject: [Mono-devel-list] can anyone help System.Decimal?


Hello,

I noticed that Decimal should hold digits for fixed point. For example,
decimal.Parse ("250.00").ToString() should return "250.00", not "250".
Anyone have enough time to look and fix it? It would be great help for
saving several System.Data.SqlTypes unit failures.

Thanks,
Atsushi Eno


_______________________________________________
Mono-devel-list mailing list
Mono-devel-list at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list




More information about the Mono-devel-list mailing list