From 1c27691ef9dddfd07b86592b40a4dca2a42e6fad Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Thu, 24 Aug 2017 13:17:25 +0200 Subject: [PATCH] Temporary fix for real::sqrt() which I broke recently. --- src/math/real.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/math/real.cpp b/src/math/real.cpp index 596ecca8..7a50ddbd 100644 --- a/src/math/real.cpp +++ b/src/math/real.cpp @@ -726,12 +726,12 @@ template<> real sqrt(real const &x) ret.m_mantissa.resize(x.m_mantissa.count()); ret.m_mantissa[0] = v.x << 9; - /* FIXME: check this, it’s been a long time… */ + /* FIXME FIXME FIXME: this is broken */ ret.m_exponent = -x.m_exponent / 2 + (v.x >> 23) - (u.x >> 23); /* FIXME: 1+log2(bigit_count()) steps of Newton-Raphson seems to be enough for * convergence, but this hasn't been checked seriously. */ - for (int i = 1; i <= x.bigit_count(); i *= 2) + for (int i = 1; i <= 1024 * x.bigit_count(); i *= 2) { ret = ret * (real::R_3() - ret * ret * x); --ret.m_exponent;