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