Float2BinaryDecimal example

$fractionbits = 52;
                break;

            default:
                return false;
        }
        if ($floatvalue >= 0) {
            $signbit = '0';
        } else {
            $signbit = '1';
        }
        $normalizedbinary  = self::NormalizeBinaryPoint(self::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 self::BigEndian2String(self::Bin2Dec($signbit.$exponentbitstring.$fractionbitstring)$bits % 8, false);
    }

    /** * @param string $byteword * * @return float|false */
Home | Imprint | This part of the site doesn't use cookies.