CSharp · Console
using System;
public class Program
{
public static void Main()
{
double a = 9007199254740891;
double b = 3;
double doubleSum = a + b;
// note that this is not just a compile-time optimization, that skips 'unneded' long->double->long casting,
// doubleSum is really keeps a binary64 value. Try to uncomment this:
// doubleSum = doubleSum + 1;
long doubleSumAsLong = (long)doubleSum;
Console.WriteLine(doubleSum.ToString("0"));
Console.WriteLine(doubleSumAsLong.ToString("0"));
}
}