]> www.ginac.de Git - cln.git/blob - src/float/dfloat/misc/cl_DF_as.cc
bad23fb971883c03bee7141aee317023ec9024cc
[cln.git] / src / float / dfloat / misc / cl_DF_as.cc
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
16 inline 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
24 const 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