Преглед изворни кода

removed dependency to dd_real #18

Nicolas Winkler пре 4 година
родитељ
комит
6ce55b1110

+ 7 - 0
libmandel/include/LightDoubleDouble.h

@@ -68,6 +68,8 @@ struct mnd::LightDoubleDouble
 {
     double x[2];
 
+    LightDoubleDouble(void) = default;
+
     inline LightDoubleDouble(double val) :
         x{ val, 0 }
     {}
@@ -112,6 +114,11 @@ inline mnd::LightDoubleDouble operator*(const mnd::LightDoubleDouble& a,
     return mnd::ldd::quickTwoSum(p1, p2);
 }
 
+inline bool operator>(const mnd::LightDoubleDouble& a,
+    const mnd::LightDoubleDouble& b)
+{
+    return a[0] > b[0] || (a[0] == b[0] && a[1] > b[1]);
+}
 
 struct mnd::LightDoubleFloat
 {

+ 7 - 7
libmandel/include/Types.h

@@ -73,10 +73,10 @@ namespace mnd
 
 #endif
 
-    using DoubleDouble = dd_real;
+    using DoubleDouble = mnd::LightDoubleDouble;
     using QuadDouble = qd_real;
 
-    inline DoubleDouble abs(const DoubleDouble& x) { return ::abs(x); }
+    /*inline DoubleDouble abs(const DoubleDouble& x) { return ::abs(x); }
     inline DoubleDouble sqrt(const DoubleDouble& x) { return ::sqrt(x); }
     inline DoubleDouble floor(const DoubleDouble& x) { return ::floor(x); }
     inline DoubleDouble log(const DoubleDouble& x) { return ::log(x); }
@@ -85,7 +85,7 @@ namespace mnd
     inline DoubleDouble atan2(const DoubleDouble& y, const DoubleDouble& x) { return ::atan2(y, x); }
     inline DoubleDouble cos(const DoubleDouble& x) { return ::cos(x); }
     inline DoubleDouble sin(const DoubleDouble& x) { return ::sin(x); }
-    inline DoubleDouble exp(const DoubleDouble& x) { return ::exp(x); }
+    inline DoubleDouble exp(const DoubleDouble& x) { return ::exp(x); }*/
 
 
     inline QuadDouble abs(const QuadDouble& x) { return ::abs(x); }
@@ -145,13 +145,13 @@ namespace mnd
         return Real{ x[0] } + x[1] + x[2];
     }
     
-    template<>
+    /*template<>
     inline DoubleDouble convert<DoubleDouble, Real>(const Real& x)
     {
         double s = static_cast<double>(x);
         double e = static_cast<double>(x - s);
         return DoubleDouble{ s, e };
-    }
+    }*/
 
     template<>
     inline LightDoubleDouble convert<LightDoubleDouble, Real>(const Real& x)
@@ -161,11 +161,11 @@ namespace mnd
         return LightDoubleDouble{ s, e };
     }
 
-    template<>
+    /*template<>
     inline float convert<float, DoubleDouble>(const DoubleDouble& x)
     {
         return float(x.x[0] + x.x[1]);
-    }
+    }*/
 
     template<>
     inline float convert<float, LightDoubleDouble>(const LightDoubleDouble& x)

+ 3 - 3
libmandel/src/NaiveIRGenerator.cpp

@@ -7,8 +7,8 @@ using mnd::NaiveIRGenerator;
 
 template class mnd::NaiveIRGenerator<float>;
 template class mnd::NaiveIRGenerator<double>;
-template class mnd::NaiveIRGenerator<mnd::DoubleDouble>;
-template class mnd::NaiveIRGenerator<mnd::QuadDouble>;
+//template class mnd::NaiveIRGenerator<mnd::DoubleDouble>;
+//template class mnd::NaiveIRGenerator<mnd::QuadDouble>;
 
 namespace mnd::eval
 {
@@ -239,7 +239,7 @@ void NaiveIRGenerator<T>::generate(const mnd::MandelInfo& info, float* data)
                 T newB = visitor.visit(*newz_im);
                 a = newA;
                 b = newB;
-                if (a * a + b * b >= 16.0)
+                if (a * a + b * b > 16.0)
                     break;
             }
             data[i + j * info.bWidth] = float(k);