Created
June 16, 2021 09:50
-
-
Save julhe/ee950eb0363433a55fe4e23e2f276aeb to your computer and use it in GitHub Desktop.
A simple test if all Int32 can be mapped into double.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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