Commit Graph

179 Commits

Author SHA1 Message Date
Tomasz Sowa aad580f51e in ASin() and Gamma() there is used SetZeroNan() to suppress a warning about an uninitialized variable (for gcc)
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@1229 e52654a7-88a9-db11-a3e9-0013d4bc506e
2019-10-23 16:09:19 +00:00
Tomasz Sowa 3b113374b7 removed: white characters from tests2/Makefile
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@1228 e52654a7-88a9-db11-a3e9-0013d4bc506e
2019-10-23 13:24:37 +00:00
Tomasz Sowa 0f2fcaf547 updated tests2 output for big_64_64 (tests2/big_64_64.expected)
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@1227 e52654a7-88a9-db11-a3e9-0013d4bc506e
2019-10-23 13:06:01 +00:00
Tomasz Sowa f88cba2688 fixed: in Parser: there was an error returned when we parsed a string which at the end had a percentage operator e.g. "10+20%"
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@1226 e52654a7-88a9-db11-a3e9-0013d4bc506e
2019-10-23 12:38:22 +00:00
Tomasz Sowa 48d694a47f added: some tests for Big<> and Parser<> classes (tests2 directory)
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@1225 e52654a7-88a9-db11-a3e9-0013d4bc506e
2019-10-15 19:14:08 +00:00
Tomasz Sowa 9a93db39c4 updated doxygen.cfg (clear config generated from 1.8.15 version)
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@1224 e52654a7-88a9-db11-a3e9-0013d4bc506e
2019-10-09 21:00:20 +00:00
Tomasz Sowa f98c434fc4 updated CHANGELOG
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@1198 e52654a7-88a9-db11-a3e9-0013d4bc506e
2019-07-31 07:21:10 +00:00
Tomasz Sowa 132fa10cd4 fixed: cannot compile on MS Windows when compiling with GCC (Mingw) for 64 bit platform:
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
2019-07-31 07:14:21 +00:00
Tomasz Sowa dcdb1db9ec fixed: a crash in Big::Add() (buffer overflow)
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
2019-04-11 16:14:04 +00:00
Tomasz Sowa d93d5ffd74 some work in the parser and refactoring
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
2018-10-30 21:04:06 +00:00
Tomasz Sowa 9b279276f2 changed: commentaries to be more doxygen friendly
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@1054 e52654a7-88a9-db11-a3e9-0013d4bc506e
2017-03-12 17:28:38 +00:00
Tomasz Sowa 83b5ab7170 changed: commentaries to be more doxygen friendly
changed: put block characters {...} is some places



git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@1053 e52654a7-88a9-db11-a3e9-0013d4bc506e
2017-03-12 17:13:37 +00:00
Tomasz Sowa 35333b1e32 added: makerelease.sh script to generate the source package tarball
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@1052 e52654a7-88a9-db11-a3e9-0013d4bc506e
2017-03-12 15:18:16 +00:00
Tomasz Sowa c73af9c116 - changed info in headers in source files: (new) BSD licence -> 3-Clause BSD Licence
- added svn:ignore in some places




git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@1051 e52654a7-88a9-db11-a3e9-0013d4bc506e
2017-03-12 14:51:21 +00:00
Tomasz Sowa f06592376f changed: some return values has been cleaned in ttmathuint.h
(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
2017-03-12 12:35:50 +00:00
Tomasz Sowa b36821024b changed: in Parser: the last commit has been changed to:
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
2017-03-12 12:34:01 +00:00
Tomasz Sowa cd740c5924 changed: in Parser: oper.erase( --oper.end() ) changed to oper.pop_back()
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
2017-02-08 09:02:52 +00:00
Tomasz Sowa 46ed8c3108 fixed: in Object::GetValueAndParam() there was value.empty() used instead of value.clear()
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@1046 e52654a7-88a9-db11-a3e9-0013d4bc506e
2017-02-08 08:42:02 +00:00
Tomasz Sowa f4f7882387 changed: changed code in some places to remove warnings generated by Visual Studio
added:   file win64_assemble.bat to compile (assemble) *.asm file for Win64



git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@1045 e52654a7-88a9-db11-a3e9-0013d4bc506e
2017-02-07 20:42:43 +00:00
Tomasz Sowa 86dc01cdee updated: CHANGELOG, COPYRIGHT, doxygen.cfg
added:   directory 'res' with logos
added:   empty directory 'doc'




git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@1044 e52654a7-88a9-db11-a3e9-0013d4bc506e
2017-02-07 14:24:58 +00:00
Tomasz Sowa 2067301d1c changed: get rid of some warnings generated by gcc and clang
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@1043 e52654a7-88a9-db11-a3e9-0013d4bc506e
2017-02-07 14:19:59 +00:00
Tomasz Sowa e2cdeac423 fixed: in x86_64 asm code (for Win64) there were in some places the esp register used,
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
2017-02-06 02:13:05 +00:00
Tomasz Sowa 5893ffa9e3 added: CMakeLists.txt files for building samples by using cmake system
submitted by Mateusz Loskot <mateusz at loskot dot net>


git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@997 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-11-28 15:59:08 +00:00
Tomasz Sowa b862422bd9 fixed: in Parser: in method SetDegRadGrad(int angle)
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
2014-04-04 23:36:48 +00:00
Tomasz Sowa cb15ac0cd8 removed: some warning messages generated by GCC from ttmathuint.h (Mul3Big3)
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@441 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-06-13 21:31:53 +00:00
Tomasz Sowa 77c41e644a corrected: the date in CHANGELOG (2012.12->2012.11)
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@438 e52654a7-88a9-db11-a3e9-0013d4bc506e
2012-11-28 16:24:00 +00:00
Tomasz Sowa 506840787a added: some pragmas for the clang compiler:
#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
2012-11-28 16:19:05 +00:00
Tomasz Sowa e58253a078 fixed: in Big::FromDouble(double value) (32 bit version)
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
2012-10-30 13:07:38 +00:00
Tomasz Sowa 6862321fad added: ttmath/ttmathdec.h
starting work on a Decimal template type


git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@381 e52654a7-88a9-db11-a3e9-0013d4bc506e
2012-02-04 16:26:11 +00:00
Tomasz Sowa 2e192969b0 changed: Big::FromString_ReadPartAfterComma()
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
2011-02-27 18:13:32 +00:00
Tomasz Sowa e8daa77d75 changed: UInt::ToString() had O(n^2) complexity
where n was the number of digits to print
         now it has O(n)



git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@340 e52654a7-88a9-db11-a3e9-0013d4bc506e
2011-02-07 22:37:44 +00:00
Tomasz Sowa 231164f6ea added: option 'group_digits' to Conv struct
you can set how many digits should be grouped



git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@338 e52654a7-88a9-db11-a3e9-0013d4bc506e
2011-01-30 17:34:42 +00:00
Tomasz Sowa c51b2fdcc9 changed: small improvements in UInt::Pow() and Big::Pow()
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@325 e52654a7-88a9-db11-a3e9-0013d4bc506e
2010-10-14 23:21:16 +00:00
Tomasz Sowa 84f34ebe52 added: Parser::InitCGamma()
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
2010-09-29 21:14:32 +00:00
Tomasz Sowa 3190f3011f changing version number to 0.9.2 release
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@320 e52654a7-88a9-db11-a3e9-0013d4bc506e
2010-09-23 20:52:20 +00:00
Tomasz Sowa a34cf55155 added TTMATH_LOG to UInt::FromUInt(ulint n)
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@319 e52654a7-88a9-db11-a3e9-0013d4bc506e
2010-09-23 19:51:55 +00:00
Tomasz Sowa 648de47400 fixed: Int::ToUInt(unsigned int & result)
wrong carry was returned


git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@318 e52654a7-88a9-db11-a3e9-0013d4bc506e
2010-09-23 19:25:26 +00:00
Tomasz Sowa 362207e2f1 added some missing methods: ToUInt, ToInt, FromUInt, FromInt in Big<> class
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@317 e52654a7-88a9-db11-a3e9-0013d4bc506e
2010-09-23 18:56:55 +00:00
Tomasz Sowa a40e951923 fixed: Big::ToDouble(double &) set always +INF (infinity)
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
2010-09-22 19:43:12 +00:00
Tomasz Sowa b028896118 added: some missing methods: ::FromUInt ::FromInt
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
2010-09-21 22:31:07 +00:00
Tomasz Sowa a67a088e3a removed: macro TTMATH_REFERENCE_ASSERT from all methods from public interface
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@314 e52654a7-88a9-db11-a3e9-0013d4bc506e
2010-09-21 15:52:48 +00:00
Tomasz Sowa 996fac15f1 in Big::ToString_CreateNewMantissaTryExponent():
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
2010-09-19 21:58:51 +00:00
Tomasz Sowa 1e268f1808 fixed: Big::ToString method
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
2010-09-19 21:54:46 +00:00
Tomasz Sowa 90674c9505 added: on 32bit platforms:
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
2010-09-19 17:23:39 +00:00
Tomasz Sowa b6fe168e3c added: Big::operator++()
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
2010-09-18 01:35:16 +00:00
Tomasz Sowa ae61b302a8 fixed: TTMATH_DEBUG_LOG has generated different carry-flags in UInt<> (when TTMATH_NOASM was used)
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
2010-09-15 20:43:21 +00:00
Tomasz Sowa a1c41c02db added: bool UInt::IsOnlyTheHighestBitSet()
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
2010-09-05 18:21:58 +00:00
Tomasz Sowa 69f065245e fixed: Big::Add sometimes incorrectly rounded the last bit from mantissa
(when exp_offset == mantissa_size_in_bits ) the rounding_up was always false


git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@303 e52654a7-88a9-db11-a3e9-0013d4bc506e
2010-08-18 23:31:58 +00:00
Tomasz Sowa c65dac524a fixed: Big::BigAnd() Big::BigOr() Big::BigXor() should have set NaN
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
2010-08-18 18:09:16 +00:00
Tomasz Sowa b3c3dd8c3f fixed: recurrence calling in Big::FromString(const std::string &, uint, const wchar_t **, bool *)
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
2010-08-18 09:22:38 +00:00