00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef GEOS_IDX_QUADTREE_DOUBLEBITS_H
00021 #define GEOS_IDX_QUADTREE_DOUBLEBITS_H
00022
00023 #include <geos/export.h>
00024 #include <geos/platform.h>
00025
00026 #include <string>
00027
00028 namespace geos {
00029 namespace index {
00030 namespace quadtree {
00031
00032
00045 class GEOS_DLL DoubleBits {
00046
00047 public:
00048
00049 static const int EXPONENT_BIAS=1023;
00050
00051 static double powerOf2(int exp);
00052
00053 static int exponent(double d);
00054
00055 static double truncateToPowerOfTwo(double d);
00056
00057 static std::string toBinaryString(double d);
00058
00059 static double maximumCommonMantissa(double d1, double d2);
00060
00061 DoubleBits(double nx);
00062
00063 double getDouble() const;
00064
00066 int64 biasedExponent() const;
00067
00069 int getExponent() const;
00070
00071 void zeroLowerBits(int nBits);
00072
00073 int getBit(int i) const;
00074
00087 int numCommonMantissaBits(const DoubleBits& db) const;
00088
00090 std::string toString() const;
00091
00092 private:
00093
00094 double x;
00095
00096 int64 xBits;
00097 };
00098
00099 }
00100 }
00101 }
00102
00103 #endif // GEOS_IDX_QUADTREE_DOUBLEBITS_H
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114