]> www.ginac.de Git - cln.git/blob - include/cln/lfloat_class.h
* All Files have been modified for inclusion of namespace cln;
[cln.git] / include / cln / lfloat_class.h
1 // Concrete class of long float numbers.
2
3 #ifndef _CL_LFLOAT_CLASS_H
4 #define _CL_LFLOAT_CLASS_H
5
6 #include "cln/number.h"
7 #include "cln/float_class.h"
8
9 namespace cln {
10
11 class cl_LF : public cl_F {
12 public:
13 // Default constructor.
14         cl_LF ();
15 // Assignment operators.
16         cl_LF& operator= (const cl_LF&);
17 // Optimization of method pointer_p().
18         cl_boolean pointer_p() const
19                 { return cl_true; }
20 // Faster pointer_p() gives a faster copy constructor (but not destructor!!!).
21         cl_LF (const cl_LF& x);
22 // Other constructors.
23         cl_LF (const char *);
24 // Private constructor.
25         cl_LF (cl_private_thing);
26         cl_LF (struct cl_heap_lfloat *);
27 // Private pointer manipulations.
28         operator struct cl_heap_lfloat * () const;
29 public: // Ability to place an object at a given address.
30         void* operator new (size_t size) { return malloc_hook(size); }
31         void* operator new (size_t size, cl_LF* ptr) { (void)size; return ptr; }
32         void operator delete (void* ptr) { free_hook(ptr); }
33 };
34 // Define this if you want the elementary cl_LF operations (+, -, *, /,
35 // sqrt, cl_LF_I_mul) to return results which are always the correctly
36 // rounded exact results, i.e. results which are correct within 0.5 ulp.
37 // If you don't define this, results will be correct within 0.50001 ulp,
38 // but often the computation will be much faster.
39 /* #define CL_LF_PEDANTIC */
40
41 // Private constructors.
42 inline cl_LF::cl_LF (cl_private_thing ptr) : cl_F (ptr) {}
43 // The assignment operators:
44 CL_DEFINE_ASSIGNMENT_OPERATOR(cl_LF, cl_LF)
45 // The default constructors.
46 // Private pointer manipulations. Never throw away a `struct cl_heap_lfloat *'!
47 inline cl_LF::operator struct cl_heap_lfloat * () const
48 {
49         struct cl_heap_lfloat * hpointer = (struct cl_heap_lfloat *) pointer;
50         cl_inc_refcount(*this);
51         return hpointer;
52 }
53 extern const cl_LF cl_LF_0;
54 inline cl_LF::cl_LF ()
55         : cl_F ((cl_private_thing) (struct cl_heap_lfloat *) cl_LF_0) {}
56 CL_REQUIRE(cl_LF_globals)
57 #if 0 // see cl_LF_impl.h
58 inline cl_LF::cl_LF (struct cl_heap_lfloat * ptr)
59         : cl_F ((cl_private_thing) ptr) {}
60 #endif
61 // The copy constructors.
62 CL_DEFINE_COPY_CONSTRUCTOR2(cl_LF,cl_F)
63
64 }  // namespace cln
65
66 #endif /* _CL_LFLOAT_CLASS_H */