summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libtwin/twin_fixed.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libtwin/twin_fixed.c b/libtwin/twin_fixed.c
index 060fb08..a4caa3a 100644
--- a/libtwin/twin_fixed.c
+++ b/libtwin/twin_fixed.c
@@ -109,6 +109,10 @@ twin_fixed_sqrt (twin_fixed_t a)
while (max > min)
{
mid = (max + min) >> 1;
+ if (mid >= 181*TWIN_FIXED_ONE) {
+ max = mid - 1;
+ continue;
+ }
sqr = twin_fixed_mul (mid, mid);
if (sqr == a)
return mid;