本文整理匯總了PHP中getid3_lib::NormalizeBinaryPoint方法的典型用法代碼示例。如果您正苦於以下問題:PHP getid3_lib::NormalizeBinaryPoint方法的具體用法?PHP getid3_lib::NormalizeBinaryPoint怎麽用?PHP getid3_lib::NormalizeBinaryPoint使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類getid3_lib
的用法示例。
在下文中一共展示了getid3_lib::NormalizeBinaryPoint方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Float2String
static function Float2String($floatvalue, $bits)
{
// http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/ieee-expl.html
switch ($bits) {
case 32:
$exponentbits = 8;
$fractionbits = 23;
break;
case 64:
$exponentbits = 11;
$fractionbits = 52;
break;
default:
return false;
break;
}
if ($floatvalue >= 0) {
$signbit = '0';
} else {
$signbit = '1';
}
$normalizedbinary = getid3_lib::NormalizeBinaryPoint(getid3_lib::Float2BinaryDecimal($floatvalue), $fractionbits);
$biasedexponent = pow(2, $exponentbits - 1) - 1 + $normalizedbinary['exponent'];
// (127 or 1023) +/- exponent
$exponentbitstring = str_pad(decbin($biasedexponent), $exponentbits, '0', STR_PAD_LEFT);
$fractionbitstring = str_pad(substr($normalizedbinary['normalized'], 2), $fractionbits, '0', STR_PAD_RIGHT);
return getid3_lib::BigEndian2String(getid3_lib::Bin2Dec($signbit . $exponentbitstring . $fractionbitstring), $bits % 8, false);
}