aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--toys/other/factor.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/toys/other/factor.c b/toys/other/factor.c
index e3992a8b..9dc1cca8 100644
--- a/toys/other/factor.c
+++ b/toys/other/factor.c
@@ -49,7 +49,9 @@ static void factor(char *s)
// test odd numbers.
for (ll=3; ;ll += 2) {
- if (ll*ll>l) {
+ long lll = ll*ll;
+
+ if (lll>l || lll<ll) {
if (l>1) printf(" %ld", l);
break;
}