diff --git a/typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php b/typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php
index 19181cd03cf998f48cd0144adb8794f3531cd9a5..7f83fbfc78d7247a957eabd50dd62cdec23d0ae8 100644
--- a/typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php
+++ b/typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php
@@ -2377,28 +2377,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;
@@ -2410,13 +2410,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 59863d73444f97b126815ce1ccb6746868641044..efc84c0afeff6e53fcfdec3eddc2efb84e8ccc7f 100644
--- a/typo3/sysext/core/Tests/Unit/Imaging/GraphicalFunctionsTest.php
+++ b/typo3/sysext/core/Tests/Unit/Imaging/GraphicalFunctionsTest.php
@@ -44,7 +44,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' => [
@@ -63,7 +63,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' => [
@@ -82,7 +82,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' => [
@@ -109,7 +109,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);
     }
 
     /**