Skip to content

Instantly share code, notes, and snippets.

@julhe
Created June 16, 2021 09:50
Show Gist options
  • Save julhe/ee950eb0363433a55fe4e23e2f276aeb to your computer and use it in GitHub Desktop.
Save julhe/ee950eb0363433a55fe4e23e2f276aeb to your computer and use it in GitHub Desktop.
A simple test if all Int32 can be mapped into double.
using System;
using System.Threading.Tasks;
namespace DoubleIntTest
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Start...");
Parallel.For(Int32.MinValue, Int32.MaxValue, (i, state) => {
double iAsDouble = i;
Int32 iRecast = (Int32)iAsDouble;
if (iRecast != i) {
// never executes on x86
Console.WriteLine($"{iRecast} != {i}");
}
});
Console.WriteLine("...Done!");
Console.ReadKey();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment