long
double
public virtual double ParseDouble(System.String val) { int shift = val[0] - NumericUtils.SHIFT_START_LONG; if (shift > 0 && shift <= 63) { throw new FieldCacheImpl.StopFillCacheException(); } return(NumericUtils.SortableLongToDouble(NumericUtils.PrefixCodedToLong(val))); }
public virtual void TestDoubles() { double[] vals = new double[] { double.NegativeInfinity, -2.3E25, -1.0E15, -1.0, -1.0E-1, -1.0E-2, -0.0, +0.0, 1.0E-2, 1.0E-1, 1.0, 1.0E15, 2.3E25, double.PositiveInfinity, double.NaN }; long[] longVals = new long[vals.Length]; // check forward and back conversion for (int i = 0; i < vals.Length; i++) { longVals[i] = NumericUtils.DoubleToSortableLong(vals[i]); Assert.IsTrue(vals[i].CompareTo(NumericUtils.SortableLongToDouble(longVals[i])) == 0, "forward and back conversion should generate same double"); } // check sort order (prefixVals should be ascending) for (int i = 1; i < longVals.Length; i++) { Assert.IsTrue(longVals[i - 1] < longVals[i], "check sort order"); } }