1 // binary operator -
2 
3 // General includes.
4 #include "base/cl_sysdep.h"
5 
6 // Specification.
7 #include "cln/dfloat.h"
8 
9 
10 // Implementation.
11 
12 #include "float/dfloat/cl_DF.h"
13 
14 namespace cln {
15 
16 
operator -(const cl_DF & x1,const cl_DF & x2)17 const cl_DF operator- (const cl_DF& x1, const cl_DF& x2)
18 {
19 // Methode:
20 // (- x1 x2) = (+ x1 (- x2))
21 #ifdef FAST_DOUBLE
22       double_to_DF(DF_to_double(x1) - DF_to_double(x2), return ,
23                    TRUE, TRUE, // Overflow und subnormale Zahl abfangen
24                    FALSE, // kein Underflow mit Ergebnis +/- 0.0 möglich
25                           // (nach Definition der subnormalen Zahlen)
26                    FALSE, FALSE // keine Singularität, kein NaN als Ergebnis möglich
27                   );
28 #else
29 #if (cl_word_size==64)
30       var dfloat x2_ = TheDfloat(x2)->dfloat_value;
31       if (DF_uexp(x2_) == 0)
32         { return x1; }
33         else
34         { return x1 + allocate_dfloat(x2_ ^ bit(63)); }
35 #else
36       var uint32 x2_semhi = TheDfloat(x2)->dfloat_value.semhi;
37       var uint32 x2_mlo = TheDfloat(x2)->dfloat_value.mlo;
38       if (DF_uexp(x2_semhi) == 0)
39         { return x1; }
40         else
41         { return x1 + allocate_dfloat(x2_semhi ^ bit(31), x2_mlo); }
42 #endif
43 #endif
44 }
45 
46 }  // namespace cln
47