X-Git-Url: https://ginac.de/CLN/cln.git//cln.git?a=blobdiff_plain;f=src%2Ffloat%2Flfloat%2Felem%2Fcl_LF_compare.cc;h=521ede824234abf22812ed81b20229129052e81f;hb=8169a19b38c42588b39b21dae5bdb964e2f6b8c6;hp=1a2e97c4f44fb829a3b2cc63b8b9507439f051e8;hpb=dd9e0f894eec7e2a8cf85078330ddc0a6639090b;p=cln.git diff --git a/src/float/lfloat/elem/cl_LF_compare.cc b/src/float/lfloat/elem/cl_LF_compare.cc index 1a2e97c..521ede8 100644 --- a/src/float/lfloat/elem/cl_LF_compare.cc +++ b/src/float/lfloat/elem/cl_LF_compare.cc @@ -1,22 +1,23 @@ -// cl_compare(). +// compare(). // General includes. -#include "cl_sysdep.h" +#include "base/cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. -#include "cl_LF.h" -#include "cl_DS.h" +#include "float/lfloat/cl_LF.h" +#include "base/digitseq/cl_DS.h" -#undef MAYBE_INLINE -#define MAYBE_INLINE inline -#include "cl_LF_minusp.cc" +#include "base/cl_inline.h" +#include "float/lfloat/elem/cl_LF_minusp.cc" -cl_signean cl_compare (const cl_LF& x, const cl_LF& y) +namespace cln { + +cl_signean compare (const cl_LF& x, const cl_LF& y) { // Methode: // x und y haben verschiedenes Vorzeichen -> @@ -25,13 +26,13 @@ cl_signean cl_compare (const cl_LF& x, const cl_LF& y) // x und y haben gleiches Vorzeichen -> // x >=0 -> vergleiche x und y (die rechten 24 Bits) // x <0 -> vergleiche y und x (die rechten 24 Bits) - if (!minusp(y)) + if (!minusp_inline(y)) // y>=0 - { if (!minusp(x)) + { if (!minusp_inline(x)) // y>=0, x>=0 { // Vergleiche Exponenten und Mantissen: - { var uintL x_uexp = TheLfloat(x)->expo; - var uintL y_uexp = TheLfloat(y)->expo; + { var uintE x_uexp = TheLfloat(x)->expo; + var uintE y_uexp = TheLfloat(y)->expo; if (x_uexp < y_uexp) return signean_minus; // x y_uexp) return signean_plus; // x>y } @@ -42,17 +43,17 @@ cl_signean cl_compare (const cl_LF& x, const cl_LF& y) var cl_signean erg = compare_loop_msp(arrayMSDptr(TheLfloat(x)->data,x_len),arrayMSDptr(TheLfloat(y)->data,y_len),len); if (!(erg==0)) { return erg; } // verschieden -> fertig - // gemeinsames Teilstück war gleich - if (x_len == y_len) { return signean_null; } // gleiche Länge -> fertig + // gemeinsames Teilstück war gleich + if (x_len == y_len) { return signean_null; } // gleiche Länge -> fertig if (x_len > y_len) - // x länger als y + // x länger als y { if (DS_test_loop(arrayMSDptr(TheLfloat(x)->data,x_len) mspop y_len,x_len-y_len,arrayLSDptr(TheLfloat(x)->data,x_len))) { return signean_plus; } // x>y else { return signean_null; } } else - // y länger als x + // y länger als x { if (DS_test_loop(arrayMSDptr(TheLfloat(y)->data,y_len) mspop x_len,y_len-x_len,arrayLSDptr(TheLfloat(y)->data,y_len))) { return signean_minus; } // x=0 { return signean_plus; } // x>y else // y<0, x<0 { // Vergleiche Exponenten und Mantissen: - { var uintL x_uexp = TheLfloat(x)->expo; - var uintL y_uexp = TheLfloat(y)->expo; + { var uintE x_uexp = TheLfloat(x)->expo; + var uintE y_uexp = TheLfloat(y)->expo; if (x_uexp < y_uexp) return signean_plus; // |x|<|y| -> x>y if (x_uexp > y_uexp) return signean_minus; // |x|>|y| -> xdata,y_len),arrayMSDptr(TheLfloat(x)->data,x_len),len); if (!(erg==0)) { return erg; } // verschieden -> fertig - // gemeinsames Teilstück war gleich - if (x_len == y_len) { return signean_null; } // gleiche Länge -> fertig + // gemeinsames Teilstück war gleich + if (x_len == y_len) { return signean_null; } // gleiche Länge -> fertig if (x_len > y_len) - // x länger als y + // x länger als y { if (DS_test_loop(arrayMSDptr(TheLfloat(x)->data,x_len) mspop y_len,x_len-y_len,arrayLSDptr(TheLfloat(x)->data,x_len))) { return signean_minus; } // |x|>|y| -> xdata,y_len) mspop x_len,y_len-x_len,arrayLSDptr(TheLfloat(y)->data,y_len))) { return signean_plus; } // |x|<|y| -> x>y else @@ -101,3 +102,5 @@ cl_signean cl_compare (const cl_LF& x, const cl_LF& y) } } } } + +} // namespace cln