I am on the first year at college studying computer science and they sent me to write a php program that can change a decimal number to IEEE754 standard on 16bits. I know most of you will laugh because it is very easy but I need help.
this is what i got so far.
ALL i need is how to control the mantissa.. you know, save 10 numbers.. and how to control the while loop so he stops when i have 10 spots on mantissa..
<?php
echo "Enter any number\n";
$number=trim(fgets(STDIN));
$low=floor($number);
$decimal=$number - $low;
$real=decbin($low);
while(0<$decimal<1)
{
$mantissa[]=$decimal*2;
}
echo "\n";
?>