Skip to content

Commit fc21a8b

Browse files
authored
Explicitly cast result of Math.pow to long in Armstrong (#4972)
1 parent f8de290 commit fc21a8b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/com/thealgorithms/maths/Armstrong.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public boolean isArmstrong(int number) {
2727

2828
while (originalNumber > 0) {
2929
long digit = originalNumber % 10;
30-
sum += Math.pow(digit, power); // The digit raised to the power of the number of digits and added to the sum.
30+
sum += (long) Math.pow(digit, power); // The digit raised to the power of the number of digits and added to the sum.
3131
originalNumber /= 10;
3232
}
3333

0 commit comments

Comments
 (0)