GEOS 3.3.8

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

DoubleBits.h
1 /**********************************************************************
2 * $Id: DoubleBits.h 2556 2009-06-06 22:22:28Z strk $
3 *
4 * GEOS - Geometry Engine Open Source
5 * http://geos.refractions.net
6 *
7 * Copyright (C) 2006 Refractions Research Inc.
8 *
9 * This is free software; you can redistribute and/or modify it under
10 * the terms of the GNU Lesser General Public Licence as published
11 * by the Free Software Foundation.
12 * See the COPYING file for more information.
13 *
14 **********************************************************************
15 *
16 * Last port: index/quadtree/DoubleBits.java rev. 1.7 (JTS-1.10)
17 *
18 **********************************************************************/
19
20 #ifndef GEOS_IDX_QUADTREE_DOUBLEBITS_H
21 #define GEOS_IDX_QUADTREE_DOUBLEBITS_H
22
23 #include <geos/export.h>
24 #include <geos/platform.h> // for int64
25
26 #include <string>
27
28 namespace geos {
29 namespace index { // geos::index
30 namespace quadtree { // geos::index::quadtree
31
32
45 class GEOS_DLL DoubleBits {
46
47 public:
48
49 static const int EXPONENT_BIAS=1023;
50
51 static double powerOf2(int exp);
52
53 static int exponent(double d);
54
55 static double truncateToPowerOfTwo(double d);
56
57 static std::string toBinaryString(double d);
58
59 static double maximumCommonMantissa(double d1, double d2);
60
61 DoubleBits(double nx);
62
63 double getDouble() const;
64
66 int64 biasedExponent() const;
67
69 int getExponent() const;
70
71 void zeroLowerBits(int nBits);
72
73 int getBit(int i) const;
74
87 int numCommonMantissaBits(const DoubleBits& db) const;
88
90 std::string toString() const;
91
92 private:
93
94 double x;
95
96 int64 xBits;
97 };
98
99 } // namespace geos::index::quadtree
100 } // namespace geos::index
101 } // namespace geos
102
103 #endif // GEOS_IDX_QUADTREE_DOUBLEBITS_H
104
105 /**********************************************************************
106 * $Log$
107 * Revision 1.2 2006/05/23 14:29:33 strk
108 * * source/headers/geos/index/quadtree/DoubleBits.h, source/index/quadtree/DoubleBits.cpp: const correctness and documentation.
109 *
110 * Revision 1.1 2006/03/22 12:22:50 strk
111 * indexQuadtree.h split
112 *
113 **********************************************************************/
114