[Mono-list] This is my test for Math.cs
yoros@wanadoo.es
yoros@wanadoo.es
Sat, 1 Feb 2003 19:01:38 +0100
--zYM0uCDKw75PZbzx
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
Hello,
Here I post the test that I'm using for compare the results of
System.Math in MONO and MS.NET.
I'm using this this command to get out all the good results and have
only different results.
cat out.mono | sed -e "s/inf/Infinito/g" -e "s/nan/NeuN/g" -e "s/e+/E+/g" -e "s/e-/E-/g" | diff - out.msnet
Of course, you must change the file format of out.msnet to unix :D
See you,
Pedro
--
Pedro Martinez Juliá
\ yoros@terra.es
)| yoros@wanadoo.es
/ http://yoros.cjb.net
Socio HispaLinux #311
Usuario Linux #275438 - http://counter.li.org
GnuPG public information: pub 1024D/74F1D3AC
Key fingerprint = 8431 7B47 D2B4 5A46 5F8E 534F 588B E285 74F1 D3AC
--zYM0uCDKw75PZbzx
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="testcase.cs"
using System;
public class EntryPoint {
public static void Main (string[] args) {
decimal[] decimals = {(decimal)1.4, (decimal)1.5, (decimal)1.6, Decimal.Zero, Decimal.One,
Decimal.MinusOne, Decimal.MaxValue, Decimal.MinValue};
double[] doubles = {0.0,1.0,-1.0,1.4,1.5,1.6,Double.Epsilon, Double.MaxValue, Double.MinValue,
Double.NaN, Double.NegativeInfinity, Double.PositiveInfinity};
float[] floats = {0.0f,1.0f,-1.0f,1.4f,1.5f,1.6f,Single.Epsilon, Single.MaxValue, Single.MinValue,
Single.NaN, Single.NegativeInfinity, Single.PositiveInfinity};
int[] ints = {0,1,-1,Int32.MinValue, Int32.MaxValue};
uint[] uints = {0,1,UInt32.MinValue, UInt32.MaxValue};
long[] longs = {0,1,-1,Int64.MinValue, Int64.MaxValue};
ulong[] ulongs = {0,1,UInt64.MinValue, UInt64.MaxValue};
short[] shorts = {0,1,-1,Int16.MinValue, Int16.MaxValue};
ushort[] ushorts = {0,1,UInt16.MinValue, UInt16.MaxValue};
sbyte[] sbytes = {0,1,-1,SByte.MinValue, SByte.MaxValue};
Console.WriteLine("DECIMAL::");
foreach (decimal value in decimals) {
Console.Write("Abs: " + value + " : ");
try {
object aux = Math.Abs(value);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
foreach (decimal value in decimals) {
foreach (decimal v2 in decimals) {
Console.Write("Max: " + value + ", " + v2 + " : ");
try {
object aux = Math.Max(value, v2);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
}
foreach (decimal value in decimals) {
foreach (decimal v2 in decimals) {
Console.Write("Min: " + value + ", " + v2 + " : ");
try {
object aux = Math.Min(value, v2);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
}
foreach (decimal value in decimals) {
Console.Write("Round: " + value + " : ");
try {
object aux = Math.Round(value);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
foreach (decimal value in decimals) {
foreach (int v2 in ints) {
Console.Write("Round: " + value + ", " + v2 + " : ");
try {
object aux = Math.Round(value,v2);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
}
foreach (decimal value in decimals) {
Console.Write("Sign: " + value + " : ");
try {
object aux = Math.Sign(value);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
Console.WriteLine();
Console.WriteLine("DOUBLE::");
foreach (double value in doubles) {
Console.Write("Abs: " + value + " : ");
try {
object aux = Math.Abs(value);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
foreach (double value in doubles) {
Console.Write("Ceiling: " + value + " : ");
try {
object aux = Math.Ceiling(value);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
foreach (double value in doubles) {
Console.Write("Floor: " + value + " : ");
try {
object aux = Math.Floor(value);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
foreach (double value in doubles) {
foreach (double v2 in doubles) {
Console.Write("IEEERemainder: " + value + ", " + v2 + " : ");
try {
object aux = Math.IEEERemainder(value, v2);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
}
foreach (double value in doubles) {
Console.Write("Log: " + value + " : ");
try {
object aux = Math.Log(value);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
foreach (double value in doubles) {
foreach (double v2 in doubles) {
Console.Write("Log: " + value + ", " + v2 + " : ");
try {
object aux = Math.Log(value,v2);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
}
foreach (double value in doubles) {
foreach (double v2 in doubles) {
Console.Write("Max: " + value + ", " + v2 + " : ");
try {
object aux = Math.Max(value, v2);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
}
foreach (double value in doubles) {
foreach (double v2 in doubles) {
Console.Write("Min: " + value + ", " + v2 + " : ");
try {
object aux = Math.Min(value, v2);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
}
foreach (double value in doubles) {
Console.Write("Round: " + value + " : ");
try {
object aux = Math.Round(value);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
foreach (double value in doubles) {
foreach (int v2 in ints) {
Console.Write("Round: " + value + ", " + v2 + " : ");
try {
object aux = Math.Round(value,v2);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
}
foreach (double value in doubles) {
Console.Write("Sign: " + value + " : ");
try {
object aux = Math.Sign(value);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
foreach (double value in doubles) {
Console.Write("Sin: " + value + " : ");
try {
object aux = Math.Sin(value);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
foreach (double value in doubles) {
Console.Write("Cos: " + value + " : ");
try {
object aux = Math.Cos(value);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
foreach (double value in doubles) {
Console.Write("Tan: " + value + " : ");
try {
object aux = Math.Tan(value);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
foreach (double value in doubles) {
Console.Write("Sinh: " + value + " : ");
try {
object aux = Math.Sinh(value);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
foreach (double value in doubles) {
Console.Write("Cosh: " + value + " : ");
try {
object aux = Math.Cosh(value);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
foreach (double value in doubles) {
Console.Write("Tanh: " + value + " : ");
try {
object aux = Math.Tanh(value);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
foreach (double value in doubles) {
Console.Write("Acos: " + value + " : ");
try {
object aux = Math.Acos(value);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
foreach (double value in doubles) {
Console.Write("Asin: " + value + " : ");
try {
object aux = Math.Asin(value);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
foreach (double value in doubles) {
Console.Write("Atan: " + value + " : ");
try {
object aux = Math.Atan(value);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
foreach (double value in doubles) {
foreach (double v2 in doubles) {
Console.Write("Atan2: " + value + ", " + v2 + " : ");
try {
object aux = Math.Atan2(value,v2);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
}
foreach (double value in doubles) {
Console.Write("Exp: " + value + " : ");
try {
object aux = Math.Exp(value);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
foreach (double value in doubles) {
Console.Write("Log: " + value + " : ");
try {
object aux = Math.Log(value);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
foreach (double value in doubles) {
Console.Write("Log10: " + value + " : ");
try {
object aux = Math.Log10(value);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
foreach (double value in doubles) {
foreach (double v2 in doubles) {
Console.Write("Pow: " + value + ", " + v2 + " : ");
try {
object aux = Math.Pow(value,v2);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
}
foreach (double value in doubles) {
Console.Write("Sqrt: " + value + " : ");
try {
object aux = Math.Abs(value);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
Console.WriteLine();
Console.WriteLine("FLOAT::");
foreach (float value in floats) {
Console.Write("Abs: " + value + " : ");
try {
object aux = Math.Abs(value);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
foreach (float value in floats) {
foreach (float v2 in floats) {
Console.Write("Max: " + value + ", " + v2 + " : ");
try {
object aux = Math.Max(value, v2);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
}
foreach (float value in floats) {
foreach (float v2 in floats) {
Console.Write("Min: " + value + ", " + v2 + " : ");
try {
object aux = Math.Min(value, v2);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
}
foreach (float value in floats) {
Console.Write("Sign: " + value + " : ");
try {
object aux = Math.Sign(value);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
Console.WriteLine();
Console.WriteLine("INT::");
foreach (int value in ints) {
Console.Write("Abs: " + value + " : ");
try {
object aux = Math.Abs(value);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
foreach (int value in ints) {
foreach (int v2 in ints) {
Console.Write("Max: " + value + ", " + v2 + " : ");
try {
object aux = Math.Max(value, v2);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
}
foreach (int value in ints) {
foreach (int v2 in ints) {
Console.Write("Min: " + value + ", " + v2 + " : ");
try {
object aux = Math.Min(value, v2);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
}
foreach (int value in ints) {
Console.Write("Sign: " + value + " : ");
try {
object aux = Math.Sign(value);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
Console.WriteLine();
Console.WriteLine("LONG::");
foreach (long value in longs) {
Console.Write("Abs: " + value + " : ");
try {
object aux = Math.Abs(value);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
foreach (long value in longs) {
foreach (long v2 in longs) {
Console.Write("Max: " + value + ", " + v2 + " : ");
try {
object aux = Math.Max(value, v2);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
}
foreach (long value in longs) {
foreach (long v2 in longs) {
Console.Write("Min: " + value + ", " + v2 + " : ");
try {
object aux = Math.Min(value, v2);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
}
foreach (long value in longs) {
Console.Write("Sign: " + value + " : ");
try {
object aux = Math.Sign(value);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
Console.WriteLine();
Console.WriteLine("SHORT::");
foreach (short value in shorts) {
Console.Write("Abs: " + value + " : ");
try {
object aux = Math.Abs(value);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
foreach (short value in shorts) {
foreach (short v2 in shorts) {
Console.Write("Max: " + value + ", " + v2 + " : ");
try {
object aux = Math.Max(value, v2);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
}
foreach (short value in shorts) {
foreach (short v2 in shorts) {
Console.Write("Min: " + value + ", " + v2 + " : ");
try {
object aux = Math.Min(value, v2);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
}
foreach (short value in shorts) {
Console.Write("Sign: " + value + " : ");
try {
object aux = Math.Sign(value);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
Console.WriteLine();
Console.WriteLine("SBYTE::");
foreach (sbyte value in sbytes) {
Console.Write("Abs: " + value + " : ");
try {
object aux = Math.Abs(value);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
foreach (sbyte value in sbytes) {
foreach (sbyte v2 in sbytes) {
Console.Write("Max: " + value + ", " + v2 + " : ");
try {
object aux = Math.Max(value, v2);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
}
foreach (sbyte value in sbytes) {
foreach (sbyte v2 in sbytes) {
Console.Write("Min: " + value + ", " + v2 + " : ");
try {
object aux = Math.Min(value, v2);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
}
foreach (sbyte value in sbytes) {
Console.Write("Sign: " + value + " : ");
try {
object aux = Math.Sign(value);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
Console.WriteLine();
Console.WriteLine("UINT::");
foreach (uint value in uints) {
foreach (uint v2 in uints) {
Console.Write("Max: " + value + ", " + v2 + " : ");
try {
object aux = Math.Max(value, v2);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
}
foreach (uint value in uints) {
foreach (uint v2 in uints) {
Console.Write("Min: " + value + ", " + v2 + " : ");
try {
object aux = Math.Min(value, v2);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
}
Console.WriteLine();
Console.WriteLine("ULONG::");
foreach (ulong value in ulongs) {
foreach (ulong v2 in ulongs) {
Console.Write("Max: " + value + ", " + v2 + " : ");
try {
object aux = Math.Max(value, v2);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
}
foreach (ulong value in ulongs) {
foreach (ulong v2 in ulongs) {
Console.Write("Min: " + value + ", " + v2 + " : ");
try {
object aux = Math.Min(value, v2);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
}
Console.WriteLine();
Console.WriteLine("USHORT::");
foreach (ushort value in ushorts) {
foreach (ushort v2 in ushorts) {
Console.Write("Max: " + value + ", " + v2 + " : ");
try {
object aux = Math.Max(value, v2);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
}
foreach (ushort value in ushorts) {
foreach (ushort v2 in ushorts) {
Console.Write("Min: " + value + ", " + v2 + " : ");
try {
object aux = Math.Min(value, v2);
Console.WriteLine(aux);
}
catch (Exception e) {
Console.WriteLine(e.GetType().FullName);
}
}
}
Console.WriteLine();
}
}
--zYM0uCDKw75PZbzx--