]> www.ginac.de Git - cln.git/blob - src/base/cl_N.h
* Adjusted dates and final touches for 1.1.1.
[cln.git] / src / base / cl_N.h
1 // cl_N internals
2
3 #ifndef _CL_N_H
4 #define _CL_N_H
5
6 #include "cln/number.h"
7 #include "cl_macros.h"
8
9 namespace cln {
10
11 nonreturning_function(extern, cl_error_division_by_0, (void));
12 nonreturning_function(extern, cl_as_error, (const cl_number& obj, const char * typestring, const char * filename, int line));
13
14 // For the equal-invariant hashcode, we take a mixture of exponent, length
15 // and the most significant 32 bits. To ensure that equal(x,y) implies
16 // equal_hashcode(x) == equal_hashcode(y) we must make sure that
17 // equal_hashcode(rational(x)) == equal_hashcode(x) and
18 // equal_hashcode(0.0) = 0 (important because of equal(complex(x,0.0),x)).
19   #define equal_hashcode_low(msd,exp,sign)  \
20     (((((uint32)(msd) << 7) | ((uint32)(msd) >> 25)) ^ ((sint32)(sign) << 30)) + (uintL)(exp))
21   #define equal_hashcode_one  equal_hashcode_low(bit(31),1,0)
22
23 }  // namespace cln
24
25 #endif /* _CL_N_H */