getid3_lib::Float2BinaryDecimal()public staticWP 1.0

{} It's a method of the class: getid3_lib{}

No Hooks.

Return

String.

Usage

$result = getid3_lib::Float2BinaryDecimal( $floatvalue );
$floatvalue(float) (required)
-

Code of getid3_lib::Float2BinaryDecimal() WP 6.0

public static function Float2BinaryDecimal($floatvalue) {
	$maxbits = 128; // to how many bits of precision should the calculations be taken?
	$intpart   = self::trunc($floatvalue);
	$floatpart = abs($floatvalue - $intpart);
	$pointbitstring = '';
	while (($floatpart != 0) && (strlen($pointbitstring) < $maxbits)) {
		$floatpart *= 2;
		$pointbitstring .= (string) self::trunc($floatpart);
		$floatpart -= self::trunc($floatpart);
	}
	$binarypointnumber = decbin($intpart).'.'.$pointbitstring;
	return $binarypointnumber;
}