Code 1.↵
↵
↵
~~~~~↵
using System;↵
↵
class P↵
{↵
static void Main()↵
{↵
double d = 1.23456;↵
Console.WriteLine(d);↵
}↵
}↵
~~~~~↵
↵
↵
↵
Code 2.↵
↵
↵
~~~~~↵
using System;↵
class P↵
{↵
static void Main()↵
{↵
double d = 1.23456;↵
Console.WriteLine(d);↵
}↵
}↵
~~~~~↵
↵
↵
Can you find difference between two?↵
↵
↵
Yes,It was JUST line feed. And,these two code lead to a different result.↵
↵
↵
↵
Result 1.`1,23456`↵
↵
↵
Result 2.`1.23456`↵
↵
↵
↵
It seems '.' replaced by ','.↵
↵
↵
The same problem occurs in Mono.↵
↵
↵
I think this probrem is bug,but I highly recommend to use substitute methods like this: ↵
↵
↵
~~~~~↵
static string doubleToString(double d)↵
{↵
int s = (int)d;↵
string a = Convert.ToInt32((d - s) * 1000000000).ToString().PadLeft(9, '0');↵
return $"{s}.{a}";↵
}↵
~~~~~↵
↵
↵
Proof:↵
[submission:33796322]↵
[submission:33796340]
↵
↵
~~~~~↵
using System;↵
↵
class P↵
{↵
static void Main()↵
{↵
double d = 1.23456;↵
Console.WriteLine(d);↵
}↵
}↵
~~~~~↵
↵
↵
↵
Code 2.↵
↵
↵
~~~~~↵
using System;↵
class P↵
{↵
static void Main()↵
{↵
double d = 1.23456;↵
Console.WriteLine(d);↵
}↵
}↵
~~~~~↵
↵
↵
Can you find difference between two?↵
↵
↵
Yes,It was JUST line feed. And,these two code lead to a different result.↵
↵
↵
↵
Result 1.`1,23456`↵
↵
↵
Result 2.`1.23456`↵
↵
↵
↵
It seems '.' replaced by ','.↵
↵
↵
The same problem occurs in Mono.↵
↵
↵
I think this probrem is bug,but I highly recommend to use substitute methods like this: ↵
↵
↵
~~~~~↵
static string doubleToString(double d)↵
{↵
int s = (int)d;↵
string a = Convert.ToInt32((d - s) * 1000000000).ToString().PadLeft(9, '0');↵
return $"{s}.{a}";↵
}↵
~~~~~↵
↵
↵
Proof:↵
[submission:33796322]↵
[submission:33796340]