Exemplo n.º 1
0
        public void WriteDouble(LazyNumberValue val)
        {
            if (val.IsNaN())
            {
                WriteBufferFor(NaNBuffer);
                return;
            }

            if (val.IsPositiveInfinity())
            {
                WriteBufferFor(PositiveInfinityBuffer);
                return;
            }

            if (val.IsNegativeInfinity())
            {
                WriteBufferFor(NegativeInfinityBuffer);
                return;
            }

            var lazyStringValue = val.Inner;

            EnsureBuffer(lazyStringValue.Size);
            WriteRawString(lazyStringValue.Buffer, lazyStringValue.Size);
        }
Exemplo n.º 2
0
        protected bool Equals(LazyNumberValue other)
        {
            if (_val != null && other._val != null)
            {
                return(Math.Abs(_val.Value - other._val.Value) < double.Epsilon);
            }

            if (_decimalVal != null && other._decimalVal != null)
            {
                return(_decimalVal.Value.Equals(other._decimalVal.Value));
            }

            return(Inner.Equals(other.Inner));
        }
        public void WriteValue(LazyNumberValue value)
        {
            var currentState = _continuationState.Pop();
            var valuePos     = _writer.WriteValue(value);

            _writeToken = new WriteToken
            {
                ValuePos     = valuePos,
                WrittenToken = BlittableJsonToken.LazyNumber
            };

            if (currentState.FirstWrite == -1)
            {
                currentState.FirstWrite = valuePos;
            }

            currentState = FinishWritingScalarValue(currentState);
            _continuationState.Push(currentState);
        }
Exemplo n.º 4
0
 public int WriteValue(LazyNumberValue value)
 {
     return(WriteValue(value.Inner));
 }