Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAtsushi Eno <atsushieno@gmail.com>2004-06-14 12:54:31 +0400
committerAtsushi Eno <atsushieno@gmail.com>2004-06-14 12:54:31 +0400
commit620e3d84e2caee43f4f3f401e9862a760fc3dc20 (patch)
treec1b657aa99f14c76c16fdbc1c4444dc4ac8c153f /mcs/class/corlib
parentf5d2c69c7ac3c9beb6e0b4c50225ba131e4e4c83 (diff)
2004-06-14 Atsushi Enomoto <atsushi@ximian.com>
* Double.cs : Use IFormatProvider.GetFormat() instead of literal '-'. * FloatingPointFormatter.cs : Use NumberFormatInfo.NegativeSign. This change saves many XSLT test failures. Format Permille pattern (It is undocumented but actually available, and used in xsl:format-number). svn path=/trunk/mcs/; revision=29483
Diffstat (limited to 'mcs/class/corlib')
-rw-r--r--mcs/class/corlib/System/ChangeLog9
-rw-r--r--mcs/class/corlib/System/Double.cs8
-rw-r--r--mcs/class/corlib/System/FloatingPointFormatter.cs12
3 files changed, 21 insertions, 8 deletions
diff --git a/mcs/class/corlib/System/ChangeLog b/mcs/class/corlib/System/ChangeLog
index 9940358cd51..ebc1a1eb8a9 100644
--- a/mcs/class/corlib/System/ChangeLog
+++ b/mcs/class/corlib/System/ChangeLog
@@ -1,3 +1,12 @@
+2004-06-14 Atsushi Enomoto <atsushi@ximian.com>
+
+ * Double.cs : Use IFormatProvider.GetFormat() instead of literal '-'.
+ * FloatingPointFormatter.cs :
+ Use NumberFormatInfo.NegativeSign. This change saves many XSLT test
+ failures.
+ Format Permille pattern (It is undocumented but actually available,
+ and used in xsl:format-number).
+
2004-06-14 Raja R Harinath <rharinath@novell.com>
* Console.cs (Console.Write, Console.WriteLine): Disable __arglist
diff --git a/mcs/class/corlib/System/Double.cs b/mcs/class/corlib/System/Double.cs
index 756d5979b41..a52c482792a 100644
--- a/mcs/class/corlib/System/Double.cs
+++ b/mcs/class/corlib/System/Double.cs
@@ -368,12 +368,8 @@ namespace System {
public string ToString (string format, IFormatProvider fp)
{
- if (fp is CultureInfo)
- return DoubleFormatter.NumberToString(format,
- ((CultureInfo)fp).NumberFormat, m_value);
- else
- return DoubleFormatter.NumberToString(format,
- (NumberFormatInfo)fp, m_value);
+ NumberFormatInfo nfi = fp != null ? fp.GetFormat (typeof (NumberFormatInfo)) as NumberFormatInfo : null;
+ return DoubleFormatter.NumberToString (format, nfi, m_value);
}
// =========== IConvertible Methods =========== //
diff --git a/mcs/class/corlib/System/FloatingPointFormatter.cs b/mcs/class/corlib/System/FloatingPointFormatter.cs
index a436b03a965..f9d2011bc82 100644
--- a/mcs/class/corlib/System/FloatingPointFormatter.cs
+++ b/mcs/class/corlib/System/FloatingPointFormatter.cs
@@ -592,7 +592,7 @@ namespace System {
return "0";
}
if (result.Length > 0) {
- result = "-" + result;
+ result = nfi.NegativeSign + result;
}
return result;
}
@@ -628,6 +628,7 @@ namespace System {
public int NumberOfColons;
public bool Groupping;
public bool Percent;
+ public bool Permille;
public int DotPos;
public int ExpPos;
public int FirstFormatPos;
@@ -676,6 +677,9 @@ namespace System {
case '%':
f.Percent = true;
break;
+ case '\u2030':
+ f.Permille = true;
+ break;
case 'e':
case 'E':
f.DecimalLength = count;
@@ -705,13 +709,17 @@ namespace System {
if (f.FirstFormatPos < 0) {
return format;
}
- if (((f.Percent) || (f.NumberOfColons > 0)) && (f.ExpPos < 0)) {
+ if (((f.Percent) || (f.Permille) || (f.NumberOfColons > 0)) && (f.ExpPos < 0)) {
int len = f.DecimalLength;
int exp = 0;
if (f.Percent) {
len += 2;
exp += 2;
}
+ else if (f.Permille) {
+ len += 3;
+ exp += 3;
+ }
if (f.NumberOfColons > 0) {
len -= (3 * f.NumberOfColons);
exp -= 3 * f.NumberOfColons;