Method code for $integer.to_bytes()

[Turn off line numbering]
  1: arg num, @long;
  2: 
  3: if (num > 1073741824)
  4:     return strfmt("%.1l", num / 1.07374e+09) + (long ? " gigabytes" : " gb");
  5: else if (num > 1048576)
  6:     return strfmt("%.1l", num / 1.04858e+06) + (long ? " megabytes" : " mb");
  7: else if (num > 1024)
  8:     return strfmt("%.1l", num / 1024.0) + (long ? " kilobytes" : " kb");
  9: return num + (long ? " bytes" : " b");

// Created 27-Mar-1995 as a part of ColdCore, see: @help Credit

Tlon