geos-3.8.0-release.zip
立即下载
资源介绍:
geos-3.8.0-release 笔者在Windows 10系统下,使用 Visual Studio 2017编译好的二进制开发包,Release版本,方便大家下载使用
/*
* This file is a part of TTMath Bignum Library
* and is distributed under the 3-Clause BSD Licence.
* Author: Tomasz Sowa
*/
/*
* Copyright (c) 2006-2017, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name Tomasz Sowa nor the names of contributors to this
* project may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef headerfilettmathbig
#define headerfilettmathbig
/*!
\file ttmathbig.h
\brief A Class for representing floating point numbers
*/
#include "ttmathint.h"
#include "ttmaththreads.h"
#include
#ifdef TTMATH_MULTITHREADS
#include
#endif
namespace ttmath
{
/*!
\brief Big implements the floating point numbers
*/
template
class Big
{
/*
value = mantissa * 2^exponent
- exponent - an integer value with a sign
- mantissa - an integer value without a sing
mantissa must be pushed into the left side that is the highest bit from
mantissa must be one (of course if there's another value than zero) -- this job
(pushing bits into the left side) is doing by Standardizing() method
for example:
if we want to store value one (1) into our Big object we must:
- set mantissa to 1
- set exponent to 0
- set info to 0
- and call method Standardizing()
*/
public:
Int exponent;
UInt mantissa;
unsigned char info;
/*!
Sign
the mask of a bit from 'info' which means that there is a sign
(when the bit is set)
*/
#define TTMATH_BIG_SIGN 128
/*!
Not a number
if this bit is set that there is not a valid number
*/
#define TTMATH_BIG_NAN 64
/*!
Zero
if this bit is set that there is value zero
mantissa should be zero and exponent should be zero too
(the Standardizing() method does this)
*/
#define TTMATH_BIG_ZERO 32
/*!
this method sets NaN if there was a carry (and returns 1 in such a case)
c can be 0, 1 or other value different from zero
*/
uint CheckCarry(uint c)
{
if( c != 0 )
{
SetNan();
return 1;
}
return 0;
}
public:
/*!
returning the string represents the currect type of the library
we have following types:
- asm_vc_32 - with asm code designed for Microsoft Visual C++ (32 bits)
- asm_gcc_32 - with asm code designed for GCC (32 bits)
- asm_vc_64 - with asm for VC (64 bit)
- asm_gcc_64 - with asm for GCC (64 bit)
- no_asm_32 - pure C++ version (32 bit) - without any asm code
- no_asm_64 - pure C++ version (64 bit) - without any asm code
*/
static const char * LibTypeStr()
{
return UInt::LibTypeStr();
}
/*!
returning the currect type of the library
*/
static LibTypeCode LibType()
{
return UInt::LibType();
}
/*!
this method moves all bits from mantissa into its left side
(suitably changes the exponent) or if the mantissa is zero
it sets the exponent to zero as well
(and clears the sign bit and sets the zero bit)
it can return a carry
the carry will be when we don't have enough space in the exponent
you don't have to use this method if you don't change the mantissa
and exponent directly
*/
uint Standardizing()
{
if( mantissa.IsTheHighestBitSet() )
{
ClearInfoBit(TTMATH_BIG_ZERO);
return 0;
}
if( CorrectZero() )
return 0;
uint comp = mantissa.CompensationToLeft();
return exponent.Sub( comp );
}
private:
/*!
if the mantissa is equal zero this method sets exponent to zero and
info without the sign
it returns true if there was the correction
*/
bool CorrectZero()
{
if( mantissa.IsZero() )
{
SetInfoBit(TTMATH_BIG_ZERO);
ClearInfoBit(TTMATH_BIG_SIGN);
exponent.SetZero();
return true;
}
else
{
ClearInfoBit(TTMATH_BIG_ZERO);
}
return false;
}
public:
/*!
this method clears a specific bit in the 'info' variable
bit is one of: TTMATH_BIG_SIGN, TTMATH_BIG_NAN etc.
*/
void ClearInfoBit(unsigned char bit)
{
info = info & (unsigned char)(~bit);
}
/*!
this method sets a specific bit in the 'info' variable
bit is one of: TTMATH_BIG_SIGN, TTMATH_BIG_NAN etc.
*/
void SetInfoBit(unsigned char bit)
{
info = info | bit;
}
/*!
this method returns true if a specific bit in the 'info' variable is set
bit is one of: TTMATH_BIG_SIGN, TTMATH_BIG_NAN etc.
*/
bool IsInfoBit(unsigned char bit) const
{
return (info & bit) != 0;
}
/*!
this method sets zero
*/
void SetZero()
{
info = TTMATH_BIG_ZERO;
exponent.SetZero();
mantissa.SetZero();
/*
we don't have to compensate zero
*/
}
/*!
this method sets one
*/
void SetOne()
{
info = 0;
mantissa.SetZero();
mantissa.table[man-1] = TTMATH_UINT_HIGHEST_BIT;
exponent = -sint(man * TTMATH_BITS_PER_UINT - 1);
// don't have to Standardize() - the last bit from mantissa is set
}
/*!
this method sets value 0.5
*/
void Set05()
{
SetOne();
exponent.SubOne();
}
/*!
this method sets NaN flag (Not a Number)
when this flag is set that means there is no a valid number
*/
void SetNan()
{
SetInfoBit(TTMATH_BIG_NAN);
}
/*!
this method sets NaN flag (Not a Number)
also clears the mantissa and exponent (similarly as it would be a zero value)
*/
void SetZeroNan()
{
SetZero();
SetNan();
}
/*!
this method swappes this for an argument
*/
void Swap(Big & ss2)
{
unsigned char info_temp = info;
info = ss2.info;
ss2.info = info_temp;
exponent.Swap(ss2.exponent);
mantissa.Swap(ss2.mantissa);
}
private:
/*!
this method sets the mantissa of the value of pi
*/
void SetMantissaPi()
{
// this is a static table which represents the value of Pi (mantissa of it)
// (first is the highest word)
// we must define this table as 'unsigned int' because
// both on 32bit and 64bit platforms this table is 32bit
static const unsigned int temp_table[] = {
0xc90fdaa2, 0x2168c234, 0xc4c6628b, 0x80dc1cd1, 0x29024e08, 0x8a67cc74, 0x020bbea6, 0x3b139b22,
0x514a0879, 0x8e3404dd, 0xef9519b3, 0xcd3a431b, 0x302b0a6d, 0xf25f1437, 0x4fe1356d, 0x6d51c245,
0xe485b576, 0x625e7ec6, 0xf44c42e9, 0xa637ed6b, 0x0bff5cb6, 0xf406b7ed, 0xee386bfb, 0x5a899fa5,
0xae9f2411, 0x7c4b1fe6, 0x49286651, 0xece45b3d, 0xc2007cb8, 0xa163bf05, 0x98da4836, 0x1c55d39a,
0x69163fa8, 0xfd24cf5f, 0x83655d23, 0xdca3ad96, 0x1c62f356, 0x208552bb, 0x9ed52907, 0x7096966d,
0x670c354e, 0x4abc9804, 0xf1746c08, 0xca18217c, 0x32905e46, 0x2e36ce3b, 0xe39e772c, 0x180e8603,
0x9b2783a2, 0xec07a28f, 0xb5c55df0, 0x6f4c52c9, 0xde2bcbf6, 0x95581718, 0x3995497c, 0xea956ae5,
0x15d22618, 0x98fa0510, 0x15728e5a, 0x8aaac42d, 0xad33170d, 0x04507a33, 0xa85521ab, 0xdf1cba64,
0xecfb8504, 0x58dbef0a,
资源文件列表:
geos-3.8.0-release.zip 大约有442个文件