// s15ag Example Program Text // C# version, NAG Copyright 2008 using System; using NagLibrary; using System.Globalization; namespace NagDotNetExamples { public class S15AGE { static string datafile = "ExampleData/s15age.d"; static void Main(String[] args) { if (args.Length == 1) { datafile = args[0]; } StartExample(); } public static void StartExample() { try { PrintManager.Warning = new PrintManager.MessageLogger(discardmessage); DataReader sr = new DataReader(datafile); double x, y; int ifail; Console.WriteLine("s15ag Example Program Results"); // // Skip heading in data file // sr.Reset(); // Console.WriteLine(""); Console.WriteLine(" {0}", " x erfcx(x) ifail"); Console.WriteLine(""); // try { while (true) { sr.Reset(); x = double.Parse(sr.Next(), CultureInfo.InvariantCulture); // // y = S.s15ag(x, out ifail); // if (ifail >= 0) { Console.WriteLine(" {0,13:e5} {1,13:e5} {2,3}", x, y, ifail); } else { Console.WriteLine("** s15ag failed with ifail = {0,5}", ifail); } // } } catch { } // } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine("Exception Raised"); } } static void discardmessage(String message) { } } }