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

- File List

# DoubleBits.h

    00001 /**********************************************************************
    00002  * $Id: DoubleBits.h 2556 2009-06-06 22:22:28Z strk $
    00003  *
    00004  * GEOS - Geometry Engine Open Source
    00005  * http://geos.refractions.net
    00006  *
    00007  * Copyright (C) 2006 Refractions Research Inc.
    00008  *
    00009  * This is free software; you can redistribute and/or modify it under
    00010  * the terms of the GNU Lesser General Public Licence as published
    00011  * by the Free Software Foundation.
    00012  * See the COPYING file for more information.
    00013  *
    00014  **********************************************************************
    00015  *
    00016  * Last port: index/quadtree/DoubleBits.java rev. 1.7 (JTS-1.10)
    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> // for int64
    00025
    00026 #include <string>
    00027
    00028 namespace geos {
    00029 namespace index { // geos::index
    00030 namespace quadtree { // geos::index::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 } // namespace geos::index::quadtree
    00100 } // namespace geos::index
    00101 } // namespace geos
    00102
    00103 #endif // GEOS_IDX_QUADTREE_DOUBLEBITS_H
    00104
    00105 /**********************************************************************
    00106  * $Log$
    00107  * Revision 1.2  2006/05/23 14:29:33  strk
    00108  * * source/headers/geos/index/quadtree/DoubleBits.h, source/index/quadtree/DoubleBits.cpp: const correctness and documentation.
    00109  *
    00110  * Revision 1.1  2006/03/22 12:22:50  strk
    00111  * indexQuadtree.h split
    00112  *
    00113  **********************************************************************/
    00114