GEOS 3.6.2
DoubleBits.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2006 Refractions Research Inc.
7 *
8 * This is free software; you can redistribute and/or modify it under
9 * the terms of the GNU Lesser General Public Licence as published
10 * by the Free Software Foundation.
11 * See the COPYING file for more information.
12 *
13 **********************************************************************
14 *
15 * Last port: index/quadtree/DoubleBits.java rev. 1.7 (JTS-1.10)
16 *
17 **********************************************************************/
18
19#ifndef GEOS_IDX_QUADTREE_DOUBLEBITS_H
20#define GEOS_IDX_QUADTREE_DOUBLEBITS_H
21
22#include <geos/export.h>
23#include <geos/platform.h> // for int64
24
25#include <string>
26
27namespace geos {
28namespace index { // geos::index
29namespace quadtree { // geos::index::quadtree
30
31
44class GEOS_DLL DoubleBits {
45
46public:
47
48 static const int EXPONENT_BIAS=1023;
49
50 static double powerOf2(int exp);
51
52 static int exponent(double d);
53
54 static double truncateToPowerOfTwo(double d);
55
56 static std::string toBinaryString(double d);
57
58 static double maximumCommonMantissa(double d1, double d2);
59
60 DoubleBits(double nx);
61
62 double getDouble() const;
63
65 int64 biasedExponent() const;
66
68 int getExponent() const;
69
70 void zeroLowerBits(int nBits);
71
72 int getBit(int i) const;
73
86 int numCommonMantissaBits(const DoubleBits& db) const;
87
89 std::string toString() const;
90
91private:
92
93 double x;
94
95 int64 xBits;
96};
97
98} // namespace geos::index::quadtree
99} // namespace geos::index
100} // namespace geos
101
102#endif // GEOS_IDX_QUADTREE_DOUBLEBITS_H
std::string toString() const
A representation of the Double bits formatted for easy readability.
int numCommonMantissaBits(const DoubleBits &db) const
This computes the number of common most-significant bits in the mantissa.
int getExponent() const
Determines the exponent for the number.
int64 biasedExponent() const
Determines the exponent for the number.
Contains classes that implement a Quadtree spatial index.
Definition DoubleBits.h:29
Provides classes for various kinds of spatial indexes.
Definition IndexedNestedRingTester.h:31
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:25