You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
2.1 KiB

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