diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/OptionConverter.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/OptionConverter.java
index aad31be..a272e91 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/OptionConverter.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/OptionConverter.java
@@ -169,18 +169,24 @@ public final class OptionConverter {
         long multiplier = 1;
         int index;
 
-        if ((index = str.indexOf("KB")) != -1) {
+        if ((index = str.indexOf("K")) != -1) {
             multiplier = ONE_K;
             str = str.substring(0, index);
-        } else if ((index = str.indexOf("MB")) != -1) {
+        } else if ((index = str.indexOf("M")) != -1) {
             multiplier = ONE_K * ONE_K;
             str = str.substring(0, index);
-        } else if ((index = str.indexOf("GB")) != -1) {
+        } else if ((index = str.indexOf("G")) != -1) {
             multiplier = ONE_K * ONE_K * ONE_K;
             str = str.substring(0, index);
+        } else if ((index = str.indexOf("T")) != -1) {
+            multiplier = ONE_K * ONE_K * ONE_K * ONE_K;
+            str = str.substring(0, index);
+        } else if ((index = str.indexOf("P")) != -1) {
+            multiplier = ONE_K * ONE_K * ONE_K * ONE_K * ONE_K;
+            str = str.substring(0, index);
         }
         try {
-            return Long.parseLong(str) * multiplier;
+            return Math.round(Double.parseDouble(str)*multiplier);
         } catch (final NumberFormatException e) {
             LOGGER.error("[{}] is not in proper int form.", str);
             LOGGER.error("[{}] not in expected format.", value, e);
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/FileSize.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/FileSize.java
index 08e6b9e..22943cf 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/FileSize.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/FileSize.java
@@ -35,20 +35,22 @@ public final class FileSize {
     private static final long KB = 1024;
     private static final long MB = KB * KB;
     private static final long GB = KB * MB;
+    private static final long TB = KB * GB;
+    private static final long PB = KB * TB;
 
     /**
      * Pattern for string parsing.
      */
     private static final Pattern VALUE_PATTERN =
-        Pattern.compile("([0-9]+([\\.,][0-9]+)?)\\s*(|K|M|G)B?", Pattern.CASE_INSENSITIVE);
+        Pattern.compile("([0-9]+([\\.,][0-9]+)?)\\s*(|K|M|G)i?B?", Pattern.CASE_INSENSITIVE);
 
     private FileSize() {
     }
 
     /**
      * Converts a string to a number of bytes. Strings consist of a floating point value followed by
-     * K, M, or G for kilobytes, megabytes, gigabytes, respectively. The
-     * abbreviations KB, MB, and GB are also accepted. Matching is case insensitive.
+     * K, M, G, T, or P for kilobytes, megabytes, gigabytes, terabytes, petabytes respectively. The
+     * abbreviations KB, MB, GB, TB, or PB are also accepted. Matching is case insensitive.
      *
      * @param string The string to convert
      * @return The Bytes value for the string
@@ -60,20 +62,24 @@ public final class FileSize {
         if (matcher.matches()) {
             try {
                 // Get double precision value
-                final long value = NumberFormat.getNumberInstance(Locale.getDefault()).parse(
-                    matcher.group(1)).longValue();
+                final double value = NumberFormat.getNumberInstance(Locale.getDefault()).parse(
+                    matcher.group(1)).doubleValue();
 
                 // Get units specified
                 final String units = matcher.group(3);
 
                 if (units.isEmpty()) {
-                    return value;
+                    return Math.round(value);
                 } else if (units.equalsIgnoreCase("K")) {
-                    return value * KB;
+                    return Math.round(value * KB);
                 } else if (units.equalsIgnoreCase("M")) {
-                    return value * MB;
+                    return Math.round(value * MB);
                 } else if (units.equalsIgnoreCase("G")) {
-                    return value * GB;
+                    return Math.round(value * GB);
+                } else if (units.equalsIgnoreCase("T")) {
+                    return Math.round(value * TB);
+                } else if (units.equalsIgnoreCase("P")) {
+                    return Math.round(value * PB);
                 } else {
                     LOGGER.error("FileSize units not recognized: " + string);
                     return defaultValue;
