]> www.ginac.de Git - cln.git/blob - src/float/misc/cl_F_as.cc
Use paths relative the `src' directory in the #include directives.
[cln.git] / src / float / misc / cl_F_as.cc
1 // cl_F_As().
2
3 // General includes.
4 #include "base/cl_sysdep.h"
5
6 // Specification.
7 #include "cln/float.h"
8
9
10 // Implementation.
11
12 #include "base/cl_N.h"
13
14 namespace cln {
15
16 inline bool cl_F_p (const cl_number& x)
17 {
18         if (!x.pointer_p())
19                 switch (cl_tag((x).word)) {
20                 case cl_SF_tag:
21                 #if defined(CL_WIDE_POINTERS)
22                 case cl_FF_tag:
23                 #endif
24                         return true;
25                 }
26         else
27                 if (x.heappointer->type->flags & cl_class_flags_subclass_float)
28                         return true;
29         return false;
30 }
31
32 const cl_F& cl_F_As (const cl_number& x, const char * filename, int line)
33 {
34         if (cl_F_p(x)) {
35                 DeclareType(cl_F,x);
36                 return x;
37         } else
38                 throw as_exception(x,"a floating-point number",filename,line);
39 }
40
41 }  // namespace cln