1 // cl_DF_As(). 2 3 // General includes. 4 #include "base/cl_sysdep.h" 5 6 // Specification. 7 #include "cln/dfloat.h" 8 9 10 // Implementation. 11 12 #include "base/cl_N.h" 13 14 namespace cln { 15 cl_DF_p(const cl_number & x)16inline bool cl_DF_p (const cl_number& x) 17 { 18 if (x.pointer_p()) 19 if (x.heappointer->type == &cl_class_dfloat) 20 return true; 21 return false; 22 } 23 cl_DF_As(const cl_number & x,const char * filename,int line)24const cl_DF& cl_DF_As (const cl_number& x, const char * filename, int line) 25 { 26 if (cl_DF_p(x)) { 27 DeclareType(cl_DF,x); 28 return x; 29 } else 30 throw as_exception(x,"a double-float number",filename,line); 31 } 32 33 } // namespace cln 34