Beispiel #1
0
    private static void test01()

//****************************************************************************80
//
//  Purpose:
//
//    TEST01 tests R4_ABS.
//
//  Licensing:
//
//    This code is distributed under the GNU LGPL license.
//
//  Modified:
//
//    25 March 2014
//
//  Author:
//
//    John Burkardt
//
    {
        float r4_hi    = 5.0f;
        float r4_lo    = -3.0f;
        int   test_num = 10;

        int seed = 123456789;

        Console.WriteLine("");
        Console.WriteLine("TEST01");
        Console.WriteLine("  R4_ABS returns the absolute value of an R4.");
        Console.WriteLine("");

        for (int test = 1; test <= test_num; test++)
        {
            float r4          = UniformRNG.r4_uniform_ab(r4_lo, r4_hi, ref seed);
            float r4_absolute = Math.Abs(r4);
            Console.WriteLine("  " + r4.ToString(CultureInfo.InvariantCulture).PadLeft(10)
                              + "  " + r4_absolute.ToString(CultureInfo.InvariantCulture).PadLeft(10) + "");
        }
    }