There is no single function that will accomplish what you want as you are rounding to varied precisions. You would need to use the round() function in different ways. For the scientific notation numbers, one solution would be to temporarily strip off the notation, and then round each number to two decimal places before popping the notation back on:
Non notation numbers it looks like you're rounding to a precision of 3 decimal places?
So something like this should do essentially what you want:
if (strpos($num,'e') !== false) {
list($num,$extra) = explode('e',$num);
$num = round($num,2).'e'.$extra;
}
else $num = round($num,3);