]> www.ginac.de Git - cln.git/blobdiff - src/float/dfloat/conv/cl_DF_from_double.cc
Cater to the fact that g++ 4.3 will use a different naming for
[cln.git] / src / float / dfloat / conv / cl_DF_from_double.cc
index 1a6e7f528eb960f521043da680480ed22c6b5dc2..eeb5fb492f2248050b9f16052167f8236511842b 100644 (file)
@@ -9,6 +9,8 @@
 
 // Implementation.
 
+namespace cln {
+
 cl_heap_dfloat* cl_double_to_DF_pointer (const dfloatjanus& val_)
 {
       var dfloat val = val_.eksplicit;
@@ -17,20 +19,20 @@ cl_heap_dfloat* cl_double_to_DF_pointer (const dfloatjanus& val_)
       if (exp == 0) // e=0 ?
         // vorzeichenbehaftete 0.0 oder subnormale Zahl
         { if (!((val << 1) == 0) && underflow_allowed())
-            { cl_error_floating_point_underflow(); }
+            { throw floating_point_underflow_exception(); }
             else
             { return cl_DF_0; } // +/- 0.0 -> 0.0
         }
       elif (exp == 2047) // e=2047 ?
         { if (!((val << (64-DF_mant_len)) == 0))
-            { cl_error_floating_point_nan(); } // NaN
+            { throw floating_point_nan_exception(); } // NaN
             else
-            { cl_error_floating_point_overflow(); } // Infinity, Overflow
+            { throw floating_point_overflow_exception(); } // Infinity, Overflow
         }
       else
-        { // Der Exponent muß um DF_exp_mid-1022 erhöht werden.
+        { // Der Exponent muß um DF_exp_mid-1022 erhöht werden.
           if ((DF_exp_mid>1022) && (exp > DF_exp_high-DF_exp_mid+1022))
-            { cl_error_floating_point_overflow(); } // Overflow
+            { throw floating_point_overflow_exception(); } // Overflow
           val += (sint64)(DF_exp_mid - 1022) << DF_mant_len;
           return allocate_dfloat(val);
         }
@@ -39,22 +41,24 @@ cl_heap_dfloat* cl_double_to_DF_pointer (const dfloatjanus& val_)
       if (exp == 0) // e=0 ?
         // vorzeichenbehaftete 0.0 oder subnormale Zahl
         { if (!(((val.semhi << 1) == 0) && (val.mlo == 0)) && underflow_allowed())
-            { cl_error_floating_point_underflow(); }
+            { throw floating_point_underflow_exception(); }
             else
             { return cl_DF_0; } // +/- 0.0 -> 0.0
         }
       elif (exp == 2047) // e=2047 ?
         { if (!(((val.semhi << (64-DF_mant_len)) == 0) && (val.mlo == 0)))
-            { cl_error_floating_point_nan(); } // NaN
+            { throw floating_point_nan_exception(); } // NaN
             else
-            { cl_error_floating_point_overflow(); } // Infinity, Overflow
+            { throw floating_point_overflow_exception(); } // Infinity, Overflow
         }
       else
-        { // Der Exponent muß um DF_exp_mid-1022 erhöht werden.
+        { // Der Exponent muß um DF_exp_mid-1022 erhöht werden.
           if ((DF_exp_mid>1022) && (exp > DF_exp_high-DF_exp_mid+1022))
-            { cl_error_floating_point_overflow(); } // Overflow
+            { throw floating_point_overflow_exception(); } // Overflow
           val.semhi += (sint32)(DF_exp_mid - 1022) << (DF_mant_len-32);
           return allocate_dfloat(val.semhi,val.mlo);
         }
       #endif
 }
+
+}  // namespace cln