1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41:
| using System; using System.Collections.Generic; using System.Linq; using System.Text;
namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Console.Title = "Rundungstest"; Console.ForegroundColor = ConsoleColor.White;
ulong x = 9999999999999999999, y = 5000000000000000000; Console.WriteLine("{0} / {1} = {2}\tMit ulong / ulong", x, y, x / y); Console.WriteLine("{0} / {1} = {2}\tMit Math.Round(ulong, double)", x, y, Math.Round(x / (double)y)); Console.WriteLine("{0} / {1} = {2}\tMit Math.Floor(ulong, double)", x, y, Math.Floor(x / (double)y)); Console.WriteLine("{0} / {1} = {2}\tMit Math.Truncate(ulong, doub)", x, y, Math.Truncate(x / (double)y)); Console.WriteLine("{0} / {1} = {2}\tMit ulong / double\n\n", x, y, (x / (double)y));
x = 999999999999999; y = 500000000000000; Console.WriteLine("{0} / {1} = {2}\tMit ulong / ulong", x, y, x / y); Console.WriteLine("{0} / {1} = {2}\tMit Math.Round(ulong, double)", x, y, Math.Round(x / (double)y)); Console.WriteLine("{0} / {1} = {2}\tMit Math.Floor(ulong, double)", x, y, Math.Floor(x / (double)y)); Console.WriteLine("{0} / {1} = {2}\tMit Math.Truncate(ulong, double)", x, y, Math.Truncate(x / (double)y)); Console.WriteLine("{0} / {1} = {2}\tMit ulong / double\n\n", x, y, (x / (double)y));
x = 99999999999999; y = 50000000000000; Console.WriteLine("{0} / {1} = {2}\tMit ulong / ulong", x, y, x / y); Console.WriteLine("{0} / {1} = {2}\tMit Math.Round(ulong, double)", x, y, Math.Round(x / (double)y)); Console.WriteLine("{0} / {1} = {2}\tMit Math.Floor(ulong, double)", x, y, Math.Floor(x / (double)y)); Console.WriteLine("{0} / {1} = {2}\tMit Math.Truncate(ulong, double)", x, y, Math.Truncate(x / (double)y)); Console.WriteLine("{0} / {1} = {2}\tMit ulong / double", x, y, (x / (double)y)); Console.Read(); } } } |