From fc21a8bffe4398ba059c76f7968f43d150985103 Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Thu, 30 Nov 2023 09:50:09 +0100 Subject: [PATCH] Explicitly cast result of `Math.pow` to `long` in `Armstrong` (#4972) --- src/main/java/com/thealgorithms/maths/Armstrong.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/thealgorithms/maths/Armstrong.java b/src/main/java/com/thealgorithms/maths/Armstrong.java index 526b31c38..ff4ae027a 100644 --- a/src/main/java/com/thealgorithms/maths/Armstrong.java +++ b/src/main/java/com/thealgorithms/maths/Armstrong.java @@ -27,7 +27,7 @@ public class Armstrong { while (originalNumber > 0) { long digit = originalNumber % 10; - sum += Math.pow(digit, power); // The digit raised to the power of the number of digits and added to the sum. + sum += (long) Math.pow(digit, power); // The digit raised to the power of the number of digits and added to the sum. originalNumber /= 10; }