Here is a drop-in replacement that should fix issues with $bytes() (up to mIRC's precision limit of $calc())
$byte(N,bkmgtp3d)
Returns comma formatted file-size.
Properties: suf

The bkmgtp options return the result as bytes, kilobytes, etc.
The .suf property appends the suffixes to the result.
The d option retains decimal point values.
The 3 option returns a result in 3 digit format.
if the int is length of 1, returns two decimals (x.xx)
if the int is length of 2, returns one decimal (xx.x)
if the int is length of 3 and contains a decimal, it's rounded so long as the round doesn't go above length of 3 (998.9 == 999), if it would, then the next option is used. If all 5 options are used up and the 6th (petabytes) still exceeds 3, it just returns like option p.

NOTES: option 3 ignores all other passed options (just like mIRC)
passing multiple options, it uses the LAST found VALID option (ignoring garbage characters, just like mIRC) in the list.
mIRC however, uses the highest found VALID option.

Highest vs Last found example:
//echo -a $bytes(1024,bktacom).suf
0TB

//echo -a $byte(1024,bktacom).suf
0MB

Comparison using "d" flag example:
//echo -a $bytes(5843560,d).suf
5.572853MB

//echo -a $byte(5843560,d).suf
5.572853MB

Below are other comparison examples covering everything else, following maroon's sections showing mIRC vs scripted.

1a.
//echo -a $bytes( $calc(2^53-1) ).suf
8,192TB

//echo -a $byte( $calc(2^53-1) ).suf
8PB

1b.
//var %a 1234567890123456 , %b 0 | while (%b <= 13) { echo -a bytes: $bytes(%a $+ $str(0,%b),3).suf | inc %b }
bytes: 1,122TB
bytes: 1,122TB
bytes: 1,122TB
bytes: 1,122TB
bytes: 1,122TB
bytes: 1,122TB
bytes: 1,122TB
bytes: 1,122TB
bytes: 1,122TB
bytes: 1,122TB
bytes: 1,122TB
bytes: 1,122TB
bytes: 1,122TB
bytes: 11,228,329,550,462,658TB


//var %a 1234567890123456 , %b 0 | while (%b <= 13) { echo -a bytes: $byte(%a $+ $str(0,%b),3).suf | inc %b }
bytes: 1.10PB
bytes: 10.9PB
bytes: 110PB
bytes: 1,096.52PB
bytes: 10,965.17PB
bytes: 109,651.66PB
bytes: 1,096,516.56PB
bytes: 10,965,165.58PB
bytes: 109,651,655.77PB
bytes: 1,096,516,557.66PB
bytes: 10,965,165,576.62PB
bytes: 109,651,655,766.24PB
bytes: 1,096,516,557,662.37PB
bytes: 10,965,165,576,623.68PB

2a.
//echo -a $bytes( $calc(999*1024+1018) ,3).suf vs $bytes( $calc(999*1024+1019) ,3).suf vs $bytes( $calc(999*1024+1024) ,3).suf
999KB vs 1,000KB vs 0.98MB

//echo -a $byte( $calc(999*1024+1018) ,3).suf vs $byte( $calc(999*1024+1019) ,3).suf vs $byte( $calc(999*1024+1024) ,3).suf
0.98MB vs 0.98MB vs 0.98MB

2b.
//echo -a $bytes($calc(500*1024+1018),3).suf vs $bytes($calc(500*1024+1018)).suf
500KB vs 500.99KB

//echo -a $byte($calc(500*1024+1018),3).suf vs $byte($calc(500*1024+1018)).suf
501KB vs 500.99KB

Code
byte {
  var %a = $1 , %b = $2 , %chart = B KB MB GB TB PB , %logn = $log(%a) / $log(1024) , %range = $pos(bkmgtp,$mid($regsubex(%b,/[^bkmgtp]/g,),-1),1)
  if (3 !isin %b) { 
    var %math = $calc($1 / 1024 ^ $iif(!%range,$iif($int(%logn) > 6,6,$v1),$calc(%range -1))) 
    if (d !isin %b) { var %math = $round(%math,2) }
  }
  else {
    var %range = 1
    while (%range <= 6) {
      var %math = $round($calc(%a / 1024 ^ (%range -1)),2)
      tokenize 46 %math
      if ($calc($len($1) + $len($2)) <= 3) { break }
      elseif ($calc($len($1) + 1) <= 3) { var %math = $mid(%math,1,4) | break }
      elseif ($len($round(%math,0)) <= 3) { var %math = $round(%math,0) | break }
      elseif (%range = 6) { break }
      else { inc %range }
    }
  }
  tokenize 46 %math
  var %int = $regsubex($1,/(\d)(?=(\d{3})+$)/g,\1 $+ $chr(44)) , %dec = $2
  if (3 isin %b) && ($len(%dec) <= 1 && $len($1) <= 2) { var %dec = $calc($2 + 0) $+ $str(0,$calc(2 - $v1))) }
  return $+(%int,$iif(%dec != $null,.),%dec,$iif($prop = suf,$gettok(%chart,$iif(!%range,$iif($calc($int(%logn) + 1) > 6,6,$v1),%range),32)))
}


May need some further testing, little unsure about xx.x portion, because I used $mid() here to get around the complication of $round(N,1) not returning one decimal if the result is within a certain size. My small-scale tests seem to show correctly compared to mIRC's returns, but I didn't test this heavily.

Examples of $round():
$round(0.9876543,2) == 0.99
$round(0.9876543,1) == 1 (not 0.9)

Example of similar result:
//echo -a $bytes($calc(1024*98 + 1002),3).suf
98.9KB

//echo -a $byte($calc(1024*98 + 1002),3).suf
98.9KB

If you swapped $mid(%math,1,4) with $round(%math,1) the result would've been:
99.0KB