public function writeFloat(Stream $stream, $value) { $bytes = pack('f*', $value); if ($this->isBigEndian) { $bytes = strrev($bytes); } $this->writeBytes($stream, $bytes, 4); }
/** * @dataProvider providerFloat */ public function testComputeFloatSize($value) { $stream = Stream::create(); $this->writer->writeFloat($stream, $value); $streamSize = $stream->getSize(); $actualSize = $this->calculator->computeFloatSize($value); $this->assertEquals($streamSize, $actualSize); }