]> www.ginac.de Git - cln.git/blob - src/float/dfloat/elem/cl_DF_uminus.cc
* */*: Remove cl_boolean, cl_true, and cl_false in favor of built-in
[cln.git] / src / float / dfloat / elem / cl_DF_uminus.cc
1 // unary operator -
2
3 // General includes.
4 #include "cl_sysdep.h"
5
6 // Specification.
7 #include "cln/dfloat.h"
8
9
10 // Implementation.
11
12 #include "cl_DF.h"
13
14 namespace cln {
15
16 const cl_DF operator- (const cl_DF& x)
17 {
18 // Methode:
19 // Falls x=0.0, fertig. Sonst Vorzeichenbit umdrehen.
20 #if (cl_word_size==64)
21       var dfloat x_ = TheDfloat(x)->dfloat_value;
22       if (DF_uexp(x_) == 0)
23         return x;
24       else
25         return allocate_dfloat( x_ ^ bit(63) );
26 #else
27       var uint32 semhi = TheDfloat(x)->dfloat_value.semhi;
28       var uint32 mlo = TheDfloat(x)->dfloat_value.mlo;
29       if (DF_uexp(semhi) == 0)
30         return x;
31       else
32         return allocate_dfloat( semhi ^ bit(31), mlo );
33 #endif
34 }
35
36 }  // namespace cln