I just read an interesing blog post: http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/. It seems that both the Java compiler and the Java runtime freeze when trying to convert the string “2.2250738585072012e-308” to a double. Next to that, the bug seems quite old and still hasn’t been fixed. Being a .NET enthousiast, it was only natural for me to try this out on .NET and the C# compiler………
The Result:
I’ve used the following code:
—————————————————————————–
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(“Test:”);
double d = Double.Parse(“2.2250738585072012e-308”);
Console.WriteLine(d);
Console.ReadKey();
}
}
}
———————————————————————————————-
Note that this wasn’t typed on my normal machine, so no fancy code plug-ins :). I am happy to announce that…………………………………………………………………………………
It just works as expected!! While I know that there must be bugs present in .Net that are not present in Java, I just thought this was worth a slight chuckle!
Have a nice weekend!!