public virtual void TestFloats() { float[] vals = new float[] { float.NegativeInfinity, -2.3E25f, -1.0E15f, -1.0f, -1.0E-1f, -1.0E-2f, -0.0f, +0.0f, 1.0E-2f, 1.0E-1f, 1.0f, 1.0E15f, 2.3E25f, float.PositiveInfinity, float.NaN }; int[] intVals = new int[vals.Length]; // check forward and back conversion for (int i = 0; i < vals.Length; i++) { intVals[i] = NumericUtils.SingleToSortableInt32(vals[i]); Assert.IsTrue(vals[i].CompareTo(NumericUtils.SortableInt32ToSingle(intVals[i])) == 0, "forward and back conversion should generate same double"); } // check sort order (prefixVals should be ascending) for (int i = 1; i < intVals.Length; i++) { Assert.IsTrue(intVals[i - 1] < intVals[i], "check sort order"); } }