Commit graph

149 commits

Author SHA1 Message Date
Matthew Lane
3c692774ac Added NewFromBigInt constructor & unit test (#56) 2017-07-28 15:12:53 -04:00
Rigel
16a9418214 added GT, GTE, LT, LTE (#54)
* added GT, GTE, LT, LTE

* GTE -> GreaterThanOrEqual
2017-05-17 18:01:17 -04:00
mattdee123
d5fda14026 Defensive Copy on Coefficient (#52) 2017-05-17 10:58:21 -04:00
Bastien Gysler
3868940cdd Fix GobDecode (#51)
This commit fixes GobDecode, which were mutating a copy of the receiver, rather than the intended pointed struct.
2017-05-09 08:51:20 -04:00
Jason Biegel
3526cd0bdb Added negative pow test 2017-02-23 11:50:30 -05:00
Evan Shaw
4b9150b187 Add Neg method (#48)
Neg provides an easy way to negate a Decimal.
2017-02-21 13:39:36 -05:00
Victor Quinn
77e6b496f6 Fix same issue as #39 but without changing the Value() interface 2017-02-21 13:34:52 -05:00
Victor Quinn
ed31524af4 Add GobEncode and GobDecode, fixes the issue raised in #23 but with Marshal/UnmarshalBinary 2017-02-21 13:23:18 -05:00
klokare
15474de08e Binary Marshalling Support (#49)
Adds MarshalBinary and UnmarshalBinary methods
2017-02-19 22:31:54 -05:00
Victor Quinn
4570ccd0d5 Merge pull request #38 from edsrzf/sign
Add Sign method
2017-02-15 21:22:53 -05:00
Victor Quinn
4ec03b4267 gofmt -s decimal_test.go 2017-02-15 19:08:34 -05:00
Victor Quinn
d48ced5acf Fix some grammar, go vet issues 2017-02-15 19:06:17 -05:00
Victor Quinn
abf4647f0d Fix misspellings 2017-02-15 19:03:27 -05:00
Victor Quinn
9f5251621e Back out travis lint as it breaks old versions of go 2017-02-15 18:59:22 -05:00
Victor Quinn
2aa9963045 Pass lint, add travis stuff to run golint 2017-02-15 18:55:38 -05:00
Victor Quinn
868a37b979 Increase test coverage a bit 2017-02-15 18:47:10 -05:00
Victor Quinn
de8af6d48f Merge pull request #42 from chrisguiney/expose-coefficient
Expose a Coefficient() function
2017-02-15 17:39:50 -05:00
Victor Quinn
c0815674f8 Merge pull request #32 from craigjackson/null_decimal
Added NullDecimal. Changed Decimal to implement driver.Valuer.

NOTE: This is potentially a breaking change as it reverts #16
2017-02-15 17:37:35 -05:00
Victor Quinn
f37fa05388 Merge pull request #46 from njason/master
Remove insignificant digits during string parsing
2017-02-15 12:26:51 -05:00
Jason Biegel
4e5e2ed948 Remove insignificant digits during string parsing 2017-02-07 12:33:26 -05:00
Evan Shaw
1aec7720a8 Add Sign method
d.Sign() is a more convenient way of saying d.Cmp(Zero).
2017-02-07 10:46:18 +13:00
Victor Quinn
5471f2c322 Merge pull request #44 from bgaifullin/master
Added method Equal instead of method Equals
2017-02-06 10:49:37 -05:00
Bulat Gaifullin
0460d2dd77 Added method Equal instead of method Equals 2017-02-06 18:46:03 +03:00
Victor Quinn
b8c85eb1cf Merge pull request #29 from martinlindhe/pow
add Pow() (fix #26)
2017-02-03 18:13:37 -05:00
Victor Quinn
ea75adedfe Merge pull request #12 from raverkamp/master
replaced divsion code
2017-01-30 10:08:29 -05:00
Victor Quinn
2ad742c865
Fix some typos, add godoc badge 2017-01-28 09:42:33 -05:00
Chris Guiney
c1c27c221b Expose a Coefficient() function 2017-01-16 14:54:52 -08:00
Craig Jackson
f03103a27d Have NullDecimal.Value() use Decimal.Value(). 2016-11-10 16:07:19 -07:00
Craig Jackson
02487a179e Added NullDecimal. Changed Decimal to implement driver.Valuer.
From comments in PR 16.
2016-11-02 10:15:14 -06:00
Martin Lindhe
8a97b04143 add Pow() 2016-09-19 23:54:54 +02:00
Vadim Graboys
d6f52241f3 allow optional marshalling JSON without quotes 2016-09-18 13:52:01 -07:00
Vadim Graboys
96e19b482b Merge branch 'tomlinford-master' 2016-09-18 13:32:48 -07:00
Vadim Graboys
db8f550fda make Value() test more realistic 2016-09-18 13:08:52 -07:00
Vadim Graboys
61927b7caf Merge pull request #27 from chrismrivera/master
Handle strings being passed to Scan()
2016-09-18 12:47:28 -07:00
Chris Rivera
8879c91b35 Handle strings being passed to Scan()
lib/pq can now pass strings to Scan() as of:
e2402a7cd1
2016-08-03 16:03:49 -04:00
Roland Averkamp
b77bff862c Merge remote-tracking branch 'upstream/master' 2016-04-25 21:20:59 +02:00
Vadim Graboys
74d668a796 Merge pull request #18 from cockroachdb/nvanbenschoten/mod
Implement Modulus arithmetic function
2016-03-11 07:45:26 -05:00
Vadim Graboys
d282b04166 Update README.md 2016-02-02 21:55:03 -05:00
Vadim Graboys
d3c5a19729 Add badginator badge, 4real 2016-02-02 21:32:16 -05:00
Vadim Graboys
95627a6ad0 Add badginator badge 2016-02-02 21:30:32 -05:00
Nathan VanBenschoten
ecd4a8353a Implement Modulus arithmetic function 2016-01-15 16:32:48 -05:00
Vadim Graboys
af95951b3f Merge pull request #15 from pwiecz/master
Add a fast track to d.Cmp(d2) when d.exp == d2.exp
2016-01-13 16:11:24 -05:00
Vadim Graboys
873b9ea5ed Merge pull request #17 from cockroachdb/nvanbenschoten/int_overflow
Prevent unnecessary int64 overflow in NewFromFloat
2016-01-13 15:47:47 -05:00
Nathan VanBenschoten
eae6d13435 Prevent unnecessary int64 overflow in NewFromFloat 2016-01-13 13:27:32 -05:00
Tom Linford
54efccb61f Make Value take a pointer receiver 2015-12-23 17:00:06 -08:00
Vadim Graboys
f95dd20cca Merge pull request #14 from faide/master
Added support for Numeric type in db storage
2015-12-18 15:06:24 -08:00
Piotr
cb949cead4 Add a fast track to d.Cmp(d2) when d.exp == d2.exp
This makes a noticeable difference when one is sorting a large slice
of decimals when most of them have the same precision, as it is saving
a lot of calls to rescale().
2015-12-11 23:54:57 +01:00
Florent AIDE
faca378c8a Adding tests from the Scan method 2015-12-11 19:46:00 +01:00
Florent AIDE
b873aa2b43 Return nil instead of empty err in Scan 2015-12-11 06:37:27 +01:00
Florent AIDE
c30673fb5f Use an idiomatic type switch for Scan type comparison 2015-12-11 06:34:52 +01:00