PHP code demo(In HTML it will work fine)
<?php
$number="10.5000";
if(preg_match("/^[1-9][0-9]*\.5[0]{0,}$/", $number))
{
echo $used = preg_replace("/\.5[0]{0,}$/", "½", $number);
}
elseif(preg_match("/^[0]*\.5[0]{0,}$/", $number))
{
echo $used = str_replace("$number", "½", $number);
}
else
{
echo $number;
}
Output:
10½
14
solved Convert .5 into 1/2