// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; class MainClass { public static void Main(string[] args) { test1(); test2(); test3(); } private static void test1() { double min = -2.34269; double max = 2.342691; double med = (min + max) / 2; Console.WriteLine(med); } private static void test2() { decimal dc_min = new decimal(-2.34269); decimal dc_max = new decimal(2.342691); decimal dc_med = (dc_min + dc_max) / new decimal(2.0); Console.WriteLine(dc_med); } private static void test3() { decimal min = -2.34269m; decimal max = 2.342691m; decimal med = (min + max) / 2; Console.WriteLine(med); } }