}
 #endif
 
-
 const int MAX_SYMBOL_FORMATS = 9;
 
 const string symbolFormatShort[MAX_SYMBOL_FORMATS] = {
         " YBytes"
 };
 
+
+long double rounding_upwards(
+        long double number,
+        const int rounding_multiplier
+)
+{
+    long double rounded_number;
+    rounded_number = number * rounding_multiplier;
+    rounded_number += 0.5;
+    rounded_number = (int64_t) (rounded_number);
+    rounded_number = (long double) (rounded_number) / (long double) (rounding_multiplier);
+
+    return rounded_number;
+}
+
+
 string nice_unit_format(
         const int64_t input,
         const UnitBase base,
 
    // round the input number "half up" to multiples of 10
    const int rounding_multiplier = 10;
-   long double tmp;
-   tmp = size * rounding_multiplier;
-   tmp += 0.5;
-   tmp = (int64_t) (tmp);
-   tmp = (long double) (tmp) / (long double) (rounding_multiplier);
-   size = tmp;
+   size = rounding_upwards(size, rounding_multiplier);
 
    // format the input number, placing the appropriate symbol
    ostringstream out;