]> www.ginac.de Git - cln.git/blobdiff - src/float/division/cl_F_trunc2.cc
Initial revision
[cln.git] / src / float / division / cl_F_trunc2.cc
diff --git a/src/float/division/cl_F_trunc2.cc b/src/float/division/cl_F_trunc2.cc
new file mode 100644 (file)
index 0000000..e1dd711
--- /dev/null
@@ -0,0 +1,30 @@
+// truncate2().
+
+// General includes.
+#include "cl_sysdep.h"
+
+// Specification.
+#include "cl_float.h"
+
+
+// Implementation.
+
+#include "cl_F.h"
+#include "cl_sfloat.h"
+#include "cl_ffloat.h"
+#include "cl_dfloat.h"
+#include "cl_lfloat.h"
+#include "cl_SF.h"
+#include "cl_FF.h"
+#include "cl_DF.h"
+#include "cl_LF.h"
+
+const cl_F_div_t truncate2 (const cl_F& x)
+{
+       floatcase(x
+       ,       var cl_SF q = ftruncate(x); return cl_F_div_t(cl_SF_to_I(q),x-q);
+       ,       var cl_FF q = ftruncate(x); return cl_F_div_t(cl_FF_to_I(q),x-q);
+       ,       var cl_DF q = ftruncate(x); return cl_F_div_t(cl_DF_to_I(q),x-q);
+       ,       var cl_LF q = ftruncate(x); return cl_F_div_t(cl_LF_to_I(q),LF_LF_minus_LF(x,q));
+       );
+}