Commit graph

188 commits

Author SHA1 Message Date
mwoss
8bc6874bc6 Grammar fix again :3 2024-04-08 00:15:37 +02:00
mwoss
508fc4f655 Grammar fix 2024-04-07 23:52:31 +02:00
mwoss
16888ead0d Add docs section with alternative libraries 2024-04-07 23:49:54 +02:00
Mateusz Woś
2fa107d0fe
Remove production usage from docs (#362) 2024-04-07 20:33:44 +02:00
Philip Dubé
645a76e5b0
Optimize BigInt (#359) 2024-04-05 21:43:23 +02:00
Mateusz Woś
ed8f76e893
Drop support for Go versions older than 1.10 (#361)
* Drop support for Go versions older than 1.10
* Remove 1.18 from test suite
2024-04-05 21:41:05 +02:00
Mateusz Woś
0e69d5cd53
Run CI on both push to origin branches and pull requests (#360) 2024-04-04 16:35:31 +02:00
Philip Dubé
bf7794e1a8
Optimize NumDigits method (#356) 2024-04-04 16:14:38 +02:00
Philip Dubé
547861c49b
Avoid reallocation of initial slice in MarshalBinary (GobEncode) (#355) 2024-04-03 22:12:19 +02:00
Mateusz Woś
78289cc844
Add improved implementation of power operation (#358)
* Adjust Pow implementation
* Add PowWithPrecision method
* Add PowInt32 method
* Add PowBigInt method
2024-04-03 00:16:27 +02:00
Mateusz Woś
2b68c56fe0
Adjust Ln method to prevent infinity iteration loops (#357)
* Adjust Ln method to prevent infinity iteration loops
* Add test case for infinity loop
2024-04-01 22:02:25 +02:00
Dovydas
d00399e161
Add NewFromBigRat constructor (#288) 2024-02-19 23:13:43 +01:00
Andrei Tudor Călin
57a340d853
Add Compare method which forwards calls to Cmp (#346)
Given the interface definition

	type Ordered[T any] interface {
		Compare(T) int
	}

And the type constraint T Ordered[T], make decimal.Decimal satisfy this
constraint, so that generic code written against T Ordered[T] can work
with decimal values as smoothly as it works with time.Time values today.

Fixes: #345
2024-01-24 23:48:15 +01:00
Chris Belsole
b79c571f80
Removed unnecessary min function for RescalePair method (#265)
Co-authored-by: Chris Belsole <chris.belsole@homelight.com>
2024-01-15 20:56:38 +01:00
Frank
b844c58a71
Fix overflow edge case in QuoRem method (#322) 2024-01-15 20:52:54 +01:00
Feras AlSaffar
142a0cf2f2
Use Godoc standard to mark deprecated Equals and StringScaled methods(#342) 2024-01-15 20:50:05 +01:00
zlasd
7b4ffbcd3c
Fix mod when the divisor is slightly greater than the half of dividend (#312) (#317) 2024-01-10 02:08:45 +01:00
zlasd
1df8fb3015
Ensure empty Decimal returns correct zero-value NumDigits (#301) 2023-12-31 13:11:33 +01:00
Jongmin Kim
572d78e32d
Fix examples for RoundDown, RoundFloor, RoundUp, and RoundCeil (#341) 2023-12-29 18:47:57 +01:00
mwoss
b4c250139b Update Go version in go.mod to match minimum version required from docs 2023-12-29 12:58:22 +01:00
Mateusz Woś
304c9d6794
Update Github Actions libraries to latest working version (#340)
* Update Github Actions libraries to the latest working version
* Update badge to show status from master branch only
2023-12-29 12:54:16 +01:00
Mateusz Woś
12e9241da2
Add implementation of natural logarithm (#339)
* Add initial implementation of natural logarithm
* Add constApproxmation struct to represent mathematical constants with their approximations
2023-12-29 01:59:48 +01:00
mwoss
88705b71ce Reformat documentation to current go standard 2023-12-28 21:05:09 +01:00
Vadim Kulagin
6926256b71
Allocate new(big.Int) in Copy method to deeply clone it (#278) 2023-12-27 15:53:43 +01:00
Mateusz Woś
f55dd56454
Migrate to Github Actions (#245)
* Migrate to Github Actions
* Remove architecture param
* Remove Travis config, update readme
2022-04-18 23:54:26 +02:00
Mateusz Woś
fa3b22f4d4
Fix incorrect calculation of decimal modulo (#258) 2021-10-21 11:22:23 +02:00
Mateusz Woś
683f5e1a7e
Release version 1.3.1 (#255) 2021-10-20 13:17:51 +02:00
lmittmann
bc96f543c2
Reduce memory allocation in case of initialization from big.Int (#252)
* reduced allocs in NewFromBigInt(...) from 3 -> 2
* remaining `big.NewInt(0).Set(...)` -> `new(big.Int).Set(...)`
2021-10-20 13:11:07 +02:00
Gaylor Bosson
cd57bf11a4
Fix binary marshalling of decimal zero value (#253)
* Fix binary marshalling of zero value
* Adapt the error message of BinaryUnmarshal
2021-10-20 12:49:41 +02:00
Mateusz Woś
2ae6f298b8
Release version 1.3.0 (#250) 2021-10-14 01:55:53 +02:00
Mateusz Woś
283b007e5f
Reformat code base and update decimal copy docs (#249) 2021-10-12 12:11:39 +02:00
Ruben de Vries
3259e0a2de
Add NewNullDecimal init method (#234) 2021-10-12 11:07:45 +02:00
Ilya Glukhov
013e52d4e9
Add Copy func (#123)
* Add Copy method
Co-authored-by: habuvo <Sin90is0>
2021-10-12 02:17:36 +02:00
Mateusz Woś
46544472a5
Add implementation of natural exponent function (Taylor, Hull-Abraham) (#229)
* Add implementation of natural exponent function (Taylor, Hull-Abraham)
* Update docs
* Improve docs, handle multithreading race condition in exp method
2021-10-11 18:39:38 +02:00
Mateusz Woś
9ffd602a49
Update Travis-CI configuration (#246)
* Update Travis-CI configuration
* Migrate to travis-ci.com
2021-09-12 13:37:52 +02:00
Mateusz Woś
b11a7c46d7
Add implementation of CoefficientInt64 method (#244)
* Add implementation of CoefficientInt64 method
2021-09-10 15:48:44 +02:00
Denis
483a047db9
Improve performance of Abs() and Round() (#240) 2021-09-09 13:03:13 +02:00
James Harris
cc4584f0a5
Add slice range checks to UnmarshalBinary() (#232)
* Add slice range checks to `UnmarshalBinary()`.
* Avoid use of `%w` verb with `Errorf()` for compatibility with older Go versions.
2021-06-23 00:24:56 +02:00
Felipe Neuwald
501661573f
Add InexactFloat64 method (#205)
* Add func (d Decimal) MustFloat64()
* renames MustFloat64 to InexactFloat64
2021-03-30 01:12:37 +02:00
Vu Long (Drake)
f77bb07828
Modify Rounding methods (#220)
* Change function name from RoundUp -> RoundCeil, RoundDown -> RoundFloor
* Add a new RoundUp and RoundDown methods
* Modify the docs of RoundUp and RoundDown
2021-03-14 22:09:56 +01:00
Bharath Ramesh
9328d16578
Added XML support for NullDecimal (#192)
* Added UnmarshalText and MarshalText support for NullDecimal
* Add tests for XML operations on NullDecimal
2021-02-18 23:32:50 +01:00
Vu Long (Drake)
99f4d74cf2
Fix wrong return RoundUp/RoundDown because of value after rescaled is ignore (#202) 2021-01-18 00:50:46 +01:00
Jason Biegel
2740f7f782 update changelog 2021-01-09 23:26:47 -05:00
nknordeen
0cada0bdfe
optimize NewFromString a bit (#198)
* optimize NewFromString a bit

* add benchmark for large number

Co-authored-by: Nicholas Nordeen <nnordeen@fanatics.com>
2021-01-09 23:15:12 -05:00
Mateusz Woś
8bd41ac55d
Implement RoundUp and RoundDown methods (#196)
* Implement RoundUp and RoundDown methods
2020-12-11 13:41:11 -05:00
sreekanth370
66332b32a9
Add power architecture support (ppc64le) to CI configuration (#188) 2020-12-01 11:15:53 +01:00
Jason Biegel
13425bb201 added vs code to gitignore 2020-11-19 00:23:29 -05:00
Mateusz Woś
ebbf8bbe36
Implement new initialization function - NewFromFormattedString (#184)
* Implement new initialization function - NewFromFormattedString
* Redefine docstring
2020-09-14 19:29:03 +02:00
mwoss
5a22b86679 Fix documentation in RoundBank method 2020-08-20 23:47:45 +02:00
jonson
867ed12000
fix the rounding bug in roundShortest method (#161)
* fix: fix rounding in FormatFloat fallback path
2020-07-07 09:05:46 +02:00