diff --git a/typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php b/typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php
index 6dce44fb91feb0b6917c03c28b2b8e7d9a7b8ca7..d389594efed44092a4a00f432c3e21f87a3ae62f 100644
--- a/typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php
+++ b/typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php
@@ -2378,28 +2378,28 @@ class GraphicalFunctions
         // If scaling should be performed. Check that input "info" array will not cause division-by-zero
         if (($w || $h) && $info[0] && $info[1]) {
             if ($w && !$h) {
-                $info[1] = ceil($info[1] * ($w / $info[0]));
+                $info[1] = (int)ceil($info[1] * ($w / $info[0]));
                 $info[0] = $w;
             }
             if (!$w && $h) {
-                $info[0] = ceil($info[0] * ($h / $info[1]));
+                $info[0] = (int)ceil($info[0] * ($h / $info[1]));
                 $info[1] = $h;
             }
             if ($w && $h) {
                 if ($max) {
                     $ratio = $info[0] / $info[1];
                     if ($h * $ratio > $w) {
-                        $h = round($w / $ratio);
+                        $h = (int)round($w / $ratio);
                     } else {
-                        $w = round($h * $ratio);
+                        $w = (int)round($h * $ratio);
                     }
                 }
                 if ($crs) {
                     $ratio = $info[0] / $info[1];
                     if ($h * $ratio < $w) {
-                        $h = round($w / $ratio);
+                        $h = (int)round($w / $ratio);
                     } else {
-                        $w = round($h * $ratio);
+                        $w = (int)round($h * $ratio);
                     }
                 }
                 $info[0] = $w;
@@ -2411,13 +2411,13 @@ class GraphicalFunctions
         // Set minimum-measures!
         if (isset($options['minW']) && $out[0] < $options['minW']) {
             if (($max || $crs) && $out[0]) {
-                $out[1] = round($out[1] * $options['minW'] / $out[0]);
+                $out[1] = (int)round($out[1] * $options['minW'] / $out[0]);
             }
             $out[0] = $options['minW'];
         }
         if (isset($options['minH']) && $out[1] < $options['minH']) {
             if (($max || $crs) && $out[1]) {
-                $out[0] = round($out[0] * $options['minH'] / $out[1]);
+                $out[0] = (int)round($out[0] * $options['minH'] / $out[1]);
             }
             $out[1] = $options['minH'];
         }
diff --git a/typo3/sysext/core/Tests/Unit/Imaging/GraphicalFunctionsTest.php b/typo3/sysext/core/Tests/Unit/Imaging/GraphicalFunctionsTest.php
index 2aa7d749aa4e279a915fba4d3c5b2d80e3ceb381..4e9ffcf06439b90333d50483685b70684d2f52d5 100644
--- a/typo3/sysext/core/Tests/Unit/Imaging/GraphicalFunctionsTest.php
+++ b/typo3/sysext/core/Tests/Unit/Imaging/GraphicalFunctionsTest.php
@@ -46,7 +46,7 @@ class GraphicalFunctionsTest extends UnitTestCase
                     'origH' => 0,
                     'max' => 0,
                     0 => 150,
-                    1 => (float)120,
+                    1 => 120,
                 ],
             ],
             'Get image scale with a maximum width of 100px' => [
@@ -65,7 +65,7 @@ class GraphicalFunctionsTest extends UnitTestCase
                     'origH' => 0,
                     'max' => 1,
                     0 => 100,
-                    1 => (float)80,
+                    1 => 80,
                 ],
             ],
             'Get image scale with a minimum width of 200px' => [
@@ -84,7 +84,7 @@ class GraphicalFunctionsTest extends UnitTestCase
                     'origH' => 0,
                     'max' => 0,
                     0 => 200,
-                    1 => (float)136,
+                    1 => 136,
                 ],
             ],
             'No PHP warning for zero in input dimensions when scaling' => [
@@ -111,7 +111,7 @@ class GraphicalFunctionsTest extends UnitTestCase
     public function getScaleForImage($info, $width, $height, $options, $expected): void
     {
         $result = (new GraphicalFunctions())->getImageScale($info, $width, $height, $options);
-        self::assertEquals($result, $expected);
+        self::assertSame($result, $expected);
     }
 
     /**