]> www.ginac.de Git - cln.git/blob - src/float/dfloat/elem/cl_DF_uminus.cc
Initial revision
[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 "cl_dfloat.h"
8
9
10 // Implementation.
11
12 #include "cl_DF.h"
13
14 const cl_DF operator- (const cl_DF& x)
15 {
16 // Methode:
17 // Falls x=0.0, fertig. Sonst Vorzeichenbit umdrehen.
18 #if (cl_word_size==64)
19       var dfloat x_ = TheDfloat(x)->dfloat_value;
20       if (DF_uexp(x_) == 0)
21         return x;
22       else
23         return allocate_dfloat( x_ ^ bit(63) );
24 #else
25       var uint32 semhi = TheDfloat(x)->dfloat_value.semhi;
26       var uint32 mlo = TheDfloat(x)->dfloat_value.mlo;
27       if (DF_uexp(semhi) == 0)
28         return x;
29       else
30         return allocate_dfloat( semhi ^ bit(31), mlo );
31 #endif
32 }