public virtual float ParseFloat(System.String val)
 {
     int shift = val[0] - NumericUtils.SHIFT_START_INT;
     if (shift > 0 && shift <= 31)
         throw new FieldCacheImpl.StopFillCacheException();
     return NumericUtils.SortableIntToFloat(NumericUtils.PrefixCodedToInt(val));
 }
            public override DocIdSet GetDocIdSet(IndexReader reader)
            {
                // we transform the floating point numbers to sortable integers
                // using NumericUtils to easier find the next bigger/lower value
                float inclusiveLowerPoint;
                float inclusiveUpperPoint;

                if (lowerVal != null)
                {
                    float f = System.Convert.ToSingle(((System.ValueType)lowerVal));
                    if (!includeUpper && f > 0.0f && System.Single.IsInfinity(f))
                    {
                        return(DocIdSet.EMPTY_DOCIDSET);
                    }
                    int i = NumericUtils.FloatToSortableInt(f);
                    inclusiveLowerPoint = NumericUtils.SortableIntToFloat(includeLower?i:(i + 1));
                }
                else
                {
                    inclusiveLowerPoint = System.Single.NegativeInfinity;
                }
                if (upperVal != null)
                {
                    float f = System.Convert.ToSingle(((System.ValueType)upperVal));
                    if (!includeUpper && f < 0.0f && System.Single.IsInfinity(f))
                    {
                        return(DocIdSet.EMPTY_DOCIDSET);
                    }
                    int i = NumericUtils.FloatToSortableInt(f);
                    inclusiveUpperPoint = NumericUtils.SortableIntToFloat(includeUpper?i:(i - 1));
                }
                else
                {
                    inclusiveUpperPoint = System.Single.PositiveInfinity;
                }

                if (inclusiveLowerPoint > inclusiveUpperPoint)
                {
                    return(DocIdSet.EMPTY_DOCIDSET);
                }

                float[] values = Lucene.Net.Search.FieldCache_Fields.DEFAULT.GetFloats(reader, field, (Lucene.Net.Search.FloatParser)parser);
                // we only request the usage of termDocs, if the range contains 0
                return(new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint, this, reader, (inclusiveLowerPoint <= 0.0f && inclusiveUpperPoint >= 0.0f)));
            }
        /// <summary>we fake a float test using int2float conversion of NumericUtils </summary>
        private void  TestFloatRange(int precisionStep)
        {
            System.String field = "ascfield" + precisionStep;
            int           lower = -1000;
            int           upper = +2000;

            System.Single tempAux  = (float)NumericUtils.SortableIntToFloat(lower);
            System.Single tempAux2 = (float)NumericUtils.SortableIntToFloat(upper);
            Query         tq       = NumericRangeQuery.NewFloatRange(field, precisionStep, tempAux, tempAux2, true, true);
            TopDocs       tTopDocs = searcher.Search(tq, 1, null);

            Assert.AreEqual(upper - lower + 1, tTopDocs.TotalHits, "Returned count of range query must be equal to inclusive range length");

            System.Single tempAux3 = (float)NumericUtils.SortableIntToFloat(lower);
            System.Single tempAux4 = (float)NumericUtils.SortableIntToFloat(upper);
            Filter        tf       = NumericRangeFilter.NewFloatRange(field, precisionStep, tempAux3, tempAux4, true, true);

            tTopDocs = searcher.Search((Query) new MatchAllDocsQuery(), tf, (int)1, (IState)null);
            Assert.AreEqual(upper - lower + 1, tTopDocs.TotalHits, "Returned count of range filter must be equal to inclusive range length");
        }