You are here

private static function PHPExcel_Reader_Excel5::_GetIEEE754 in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5.php \PHPExcel_Reader_Excel5::_GetIEEE754()
2 calls to PHPExcel_Reader_Excel5::_GetIEEE754()
PHPExcel_Reader_Excel5::_readMulRk in vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5.php
* Read MULRK record * This record represents a cell range containing RK value * cells. All cells are located in the same row. * * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format"
PHPExcel_Reader_Excel5::_readRk in vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5.php
* Read RK record * This record represents a cell that contains an RK value * (encoded integer or floating-point value). If a * floating-point value cannot be encoded to an RK value, * a NUMBER record will be written. This record replaces the …

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5.php, line 6694

Class

PHPExcel_Reader_Excel5
PHPExcel_Reader_Excel5

Code

private static function _GetIEEE754($rknum) {
  if (($rknum & 0x2) != 0) {
    $value = $rknum >> 2;
  }
  else {

    // changes by mmp, info on IEEE754 encoding from
    // research.microsoft.com/~hollasch/cgindex/coding/ieeefloat.html
    // The RK format calls for using only the most significant 30 bits
    // of the 64 bit floating point value. The other 34 bits are assumed
    // to be 0 so we use the upper 30 bits of $rknum as follows...
    $sign = ($rknum & 0x80000000) >> 31;
    $exp = ($rknum & 0x7ff00000) >> 20;
    $mantissa = 0x100000 | $rknum & 0xffffc;
    $value = $mantissa / pow(2, 20 - ($exp - 1023));
    if ($sign) {
      $value = -1 * $value;
    }

    //end of changes by mmp
  }
  if (($rknum & 0x1) != 0) {
    $value /= 100;
  }
  return $value;
}