Read a 32-bit float

@return float
@throws \GameQ\Exception\Protocol
431741
public function readFloat32()
    {

        // Read the data into a string
        $string = $this->read(4);

        // For big endian we need to reverse the bytes
        if ($this->number_type == self::NUMBER_TYPE_BIGENDIAN) {
            $string = strrev($string);
        }

        $float = unpack('ffloat', $string);

        unset($string);

        return $float['float'];
    }
785472
public function castFloat()
    {
        $castFunction = function ($value) {
            return (float) $value;
        };

        if (is_numeric($this->value)) {
            return $castFunction($this->value);
        }

        return $this->handleMismatch($castFunction, 'double');
    }
1294517
final public function readInt16BE()
    {
        if ($this->isLittleEndian()) {
            return $this->fromInt16(strrev($this->read(2)));
        } else {
            return $this->fromInt16($this->read(2));
        }
    }
1328416
public function readVInt()
    {
        $nextByte = ord($this->_fread(1));
        $val = $nextByte & 0x7F;

        for ($shift=7; ($nextByte & 0x80) != 0; $shift += 7) {
            $nextByte = ord($this->_fread(1));
            $val |= ($nextByte & 0x7F) << $shift;
        }
        return $val;
    }
1234457
private static function _floatToByte($f)
    {
        // round negatives up to zero
        if ($f <= 0.0) {
            return 0;
        }

        // search for appropriate value
        $lowIndex = 0;
        $highIndex = 255;
        while ($highIndex >= $lowIndex) {
            // $mid = ($highIndex - $lowIndex)/2;
            $mid = ($highIndex + $lowIndex) >> 1;
            $delta = $f - self::$_normTable[$mid];

            if ($delta < 0) {
                $highIndex = $mid-1;
            } elseif ($delta > 0) {
                $lowIndex  = $mid+1;
            } else {
                return $mid; // We got it!
            }
        }

        // round to closest value
        if ($highIndex != 255 
            && $f - self::$_normTable[$highIndex] > self::$_normTable[$highIndex+1] - $f 
        ) {
            return $highIndex + 1;
        } else {
            return $highIndex;
        }
    }
436025
public function readInt64()
    {

        // We have the pack 64-bit codes available. See: http://php.net/manual/en/function.pack.php
        if (version_compare(PHP_VERSION, '5.6.3') >= 0 && PHP_INT_SIZE == 8) {
            // Change the integer type we are looking up
            switch ($this->number_type) {
                case self::NUMBER_TYPE_BIGENDIAN:
                    $type = 'Jint';
                    break;

                case self::NUMBER_TYPE_LITTLEENDIAN:
                    $type = 'Pint';
                    break;

                default:
                    $type = 'Qint';
            }

            $int64 = unpack($type, $this->read(8));

            $int = $int64['int'];

            unset($int64);
        } else {
            if ($this->number_type == self::NUMBER_TYPE_BIGENDIAN) {
                $high = $this->readInt32();
                $low = $this->readInt32();
            } else {
                $low = $this->readInt32();
                $high = $this->readInt32();
            }

            // We have to determine the number via bitwise
            $int = ($high << 32) | $low;

            unset($low, $high);
        }

        return $int;
    }
1044164
final public function readInt24LE()
    {
        if ($this->isBigEndian()) {
            return $this->fromInt24(strrev($this->read(3)));
        } else {
            return $this->fromInt24($this->read(3));
        }
    }
677877
public function get8() {
    if ($this->idx >= $this->limit) {
      throw new ProtocolBufferDecodeError("truncated");
    }
    $c = unpack("C*", substr($this->buf, $this->idx, 1));
    $this->idx += 1;
    return $c[1];
  }
1344168
public function readBinary()
    {
        $length = $this->readVInt();
        $returnValue = substr($this->_data, $this->_position, $length);
        $this->_position += $length;
        return $returnValue;
    }
1085458
public function toMicro()
    {
        $inner = $this->getAttribute("amount", false); //cast=false
        $decimals = $this->getDivisibility();

        if (is_integer($inner)) {
            $attrib = $inner;
        }
        elseif (is_float($inner)) {
            // we want only integer!
            $attrib = $inner * pow(10, $decimals);
        }
        elseif (is_string($inner)) {
            // parse number string representation. Parsing to float.
            $isFloat = false !== strpos($inner, ".");
            $number = $isFloat ? (float) $inner : (int) $inner;
            $multi  = $isFloat ? pow(10, $decimals) : 1;
            $attrib = $number * $multi;
        }
        elseif (is_array($inner)) {
            // try to read first value of array
            $attrib = array_shift($inner);
        }
        else {
            $attrib = (int) $inner;
        }

        $this->micro = (int) $attrib;
        if ($this->micro < 0)
            // not allowed: 0 in micro XEM is the minimum possible value!
            $this->micro = 0;

        return $this->micro;
    }
1035820
public function readLong()
    {
        $this->_bitcount = $this->_bits = 0;
        list(, $res) = unpack('N', $this->_rawread(4));
        $sres = sprintf("%u", $res);
        return $sres;
    }
746907
public function readIntLen()
    {
        $f = $this->readInt1();
        if ($f <= 250) {
            return $f;
        }
        if ($f === 251) {
            return null;
        }
        if ($f === 252) {
            return $this->readInt2();
        }
        if ($f === 253) {
            return $this->readInt3();
        }

        return $this->readInt8();
    }
420373
public function castByte()
    {
        $min = self::BYTE_MIN_VALUE;
        $max = self::BYTE_MAX_VALUE;

        $castFunction = function ($value) use ($min, $max) {
            return $value < 0 ? $min : $max;
        };

        if (is_numeric($this->value) && $this->value >= $min && $this->value <= $max) {
            return $this->value;
        }

        return $this->handleMismatch($castFunction, 'byte');
    }
590297
public function readByte()
    {
        if (($this->_needle + 1) > $this->_streamLength) {
            require_once 'Zend/Amf/Exception.php';
            throw new Zend_Amf_Exception('Buffer underrun at needle position: ' . $this->_needle . ' while requesting length: ' . $length);
        }

        return ord($this->_stream{$this->_needle++});
    }
1030416
public function parseFloat()
    {
        try {
            if (Endianness::LITTLE()) {
                return \unpack('f', \strrev(mb_orig_substr($this->buffer, 0, 4)))[1];
            }
            return \unpack('f', $this->buffer)[1]; // @codeCoverageIgnore
        } finally {
            $this->buffer = mb_orig_substr($this->buffer, 4);
        }
    }
685790
def read_float(self):
        """"""
        self.bitcount = self.bits = 0
        return unpack('>d', self.input.read(8))[0]
109228
@Override
	public int read() throws IOException {
		if (pos >= limit)
			return -1;

		try {
			int c = buf[pos] & 0xff;
			if (c < 0x80) {
				pos++;
			} else if (c < 0xE0) {
				c = (char) ((c & 0x1F) << 6 | buf[pos + 1] & 0x3F);
				pos += 2;
			} else {
				c = (char) ((c & 0x0F) << 12 | (buf[pos + 1] & 0x3F) << 6 | (buf[pos + 2] & 0x3F));
				pos += 3;
			}
			if (pos > limit)
				throw new IOException();
			return c;
		} catch (ArrayIndexOutOfBoundsException e) {
			throw new IOException(e);
		}
	}