incorrect size of ttmath::uint and ::sint were used
they were 'long' but 'long' is a 32bit type on Windows
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@1197 e52654a7-88a9-db11-a3e9-0013d4bc506e
there was an offset calculated from Int type by using Abs() method and a carry was not checked
(if there is a carry we should not make addition -- the argument is too small)
this had no impact on calculated values because there was a crash (bus error) immediately
following program could crash (64bit):
typedef ttmath::Big<1, 8> MyBig;
ttmath::Parser<MyBig> parser;
parser.Parse("2^(2^63) + 1");
fixed: similar problems were in methods Big::BitAnd() Big::BitOr() and Big::BitXor() (bitwise operations)
and they could return incorrect values
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@1189 e52654a7-88a9-db11-a3e9-0013d4bc506e
added a new math operator: assign
now we can assign a value to a variable (not finished yet)
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@1137 e52654a7-88a9-db11-a3e9-0013d4bc506e
(eclipse builtin parser reported errors but actually the code was correct)
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@1050 e52654a7-88a9-db11-a3e9-0013d4bc506e
oper.erase(oper.begin() + oper.size() - 1)
because oper.pop_back() is available from c++11
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@1049 e52654a7-88a9-db11-a3e9-0013d4bc506e
to allow use of the STL port
(reported on the ttmath forum by Sebo)
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@1047 e52654a7-88a9-db11-a3e9-0013d4bc506e
there should be rsp used instead
(reported by Villi on the tttmath forum)
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@1042 e52654a7-88a9-db11-a3e9-0013d4bc506e
there is incorrectly use || operator (the && shoud be used)
reported by heby on the ttmath forum
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@450 e52654a7-88a9-db11-a3e9-0013d4bc506e
#pragma clang diagnostic ignored "-Wtautological-compare"
to get rid off some warning messages
changed: changing version number to 0.9.3 release
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@436 e52654a7-88a9-db11-a3e9-0013d4bc506e
buffer overflow in referencing to UInt<2>
(instead of m.table[2] should be m.table[0])
this was used when: E=0 and F is nonzero (double "unnormalized" values)
it produced incorrect mantissa (on about 8th decimal digit up)
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@435 e52654a7-88a9-db11-a3e9-0013d4bc506e
now we're reading the all part as integer and
at the end we're dividing it by (base ^ how_many_digits_there_were)
it's faster and should be a little accurate in some cases
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@342 e52654a7-88a9-db11-a3e9-0013d4bc506e
initializing coefficients used when calculating the gamma (or factorial) function
this speed up the next calculations
you don't have to call this method explicitly
these coefficients will be calculated when needed
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@324 e52654a7-88a9-db11-a3e9-0013d4bc506e
when the value was too large (even for negative values)
(it should set -INF in such a case)
added: some missing methods for converting
for UInt<>, Int<> and Big<> classes:
uint ToUInt()
sint ToInt()
ToUInt(uint32_t &)
ToInt(uint32_t &)
ToInt(int32_t &)
ToUInt(uint64_t &)
ToInt(uint64_t &)
ToInt(int64_t &)
FromUInt(uint32_t &)
FromInt(uint32_t &)
FromInt(int32_t &)
FromUInt(uint64_t &)
FromInt(uint64_t &)
FromInt(int64_t &)
and appropriate constructors and operators
*** version for 64 bit platforms are not tested yet ***
added: double Big::ToDouble() /there was only Big::ToDouble(double &) /
uint Big::ToFloat(float &)
float Big::ToFloat()
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@316 e52654a7-88a9-db11-a3e9-0013d4bc506e
now ::FromInt can be used in place of ::FromUint
sample:
UInt<1> a;
a.FromInt(10); // previous was only: a.FromUInt(10)
changed: std::string Big::ToString(uint base = 10) const
std::wstring Big::ToWString(uint base = 10) const
can take optional parameter (base)
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@315 e52654a7-88a9-db11-a3e9-0013d4bc506e
ToString_BaseRound can be called only for non integer values
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@313 e52654a7-88a9-db11-a3e9-0013d4bc506e
in some cases when in the output string the exponent should be equal zero
the method changes the exponent to one so the last digit from the mantissa
was lost
sample:
Big<1,1> a;
a.info = 0;
a.mantissa = 2147483649u; // (bin) 10000000000000000000000000000001
// first and last bit in the mantissa is set
a.exponent = 0;
std::cout << a << std::endl;
priovious result: 2147483640
it was treated as 214748364e+1
also the method has been a little improved
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@312 e52654a7-88a9-db11-a3e9-0013d4bc506e
uint UInt::FromUInt(uint64_t n)
uint Int::FromInt(int64_t n)
void Big::FromUInt(uint64_t n)
void Big::FromInt(int64_t n)
and appropriate constructors and operators
added: TTMATH_FORCEASM macro
asm version of the library is available by default only for:
x86 and amd64 platforms and for Microsoft Visual and GCC compilers,
but you can force using asm version (the same asm as for Microsoft Visual)
by defining TTMATH_FORCEASM macro
you have to be sure that your compiler accept such an asm format
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@311 e52654a7-88a9-db11-a3e9-0013d4bc506e
Big::operator++(int)
Big::operator--()
Big::operator--(int)
Big::AddOne()
Big::SubOne()
changed: Big::SetOne()
a little faster now
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@310 e52654a7-88a9-db11-a3e9-0013d4bc506e
fixed: some GCC warnings about uninitialized variables
added: macro TTMATH_BIG_DEFAULT_CLEAR
when defined the default constructor from Big<> clears its mantissa and exponent
Big<1, 2> var;
var.mantissa and var.exponent will be set to zero
(but var has the NaN flag set too - it is not zero value, this is mainly for debug purposes)
added: Big::SetZeroNan()
this method sets NaN flag (Not a Number)
also clears the mantissa and exponent (similarly as it would be a zero value)
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@309 e52654a7-88a9-db11-a3e9-0013d4bc506e
bool UInt::IsOnlyTheLowestBitSet()
returning true if only the highest/lowest bit is set
added: uint Int::MulInt(sint ss2)
added: void UInt::Swap(UInt<value_size> & ss2)
void Big::Swap(UInt<value_size> & ss2)
method for swapping this for an argument
changed: small optimization in Big::Sub()
changed: now asm version is available only on x86 and amd64
(and only for GCC and MS VC compilers)
removed: macro TTMATH_RELEASE
for debug version define TTMATH_DEBUG macro
TTMATH_DEBUG is also automatically defined when DEBUG or _DEBUG is set
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@304 e52654a7-88a9-db11-a3e9-0013d4bc506e
when the argument was negative (they only returned 2)
added: some missing operators
UInt::operator~() /* bitwise neg */
UInt::operator&() /* bitwise and */
UInt::operator&=()
UInt::operator|() /* bitwise or */
UInt::operator|=()
UInt::operator^() /* bitwise xor */
UInt::operator^=()
Big::operator&()
Big::operator&=()
Big::operator|()
Big::operator|=()
Big::operator^()
Big::operator^=()
for Big<> we do not define bitwise neg
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@302 e52654a7-88a9-db11-a3e9-0013d4bc506e
it should have the signature: Big::FromString(const std::string &, uint, const char **, bool *)
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@301 e52654a7-88a9-db11-a3e9-0013d4bc506e