chore(deps): update rust crate rust_decimal to 1.35.0 #13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
1.34.3
->1.35.0
Release Notes
paupino/rust-decimal (rust_decimal)
v1.35.0
Compare Source
Fixed
Error (#653)
Changed
postgres-types
crate. (#651)
Credit
Thank you to @the-kenny for your contribution!
1.34.3
Fixed
NUMERIC
value from PostgreSQL it would sometimes generate aninvalid
Decimal (#647)
1.34.2
Fixed
macros
feature until circular dependency issue is resolved properly.1.34.1
Fixed
macros
feature.1.34.0
Added
rust_decimal_macros
can now be utilized using themacros
featureflag. (#628)
Fixed
pow
function to more effectively handle largerexponents (#638)
Decimal
from a string when a decimal point or placeholder is at the roundingposition (#636)
Changed
examples. (#630)
improvements (#633, #634)
Credit
Thank you to @robjtede and @schungx for your contributions
this release.
Last but not least, a special thank you to @Tony-Samuels for your help with
managing
rust_decimal
!1.33.1
Fixed
Decimal
to a float whereby the float would be inaccurate afterrounding. (#625)
1.33.0
Fixed
Decimal
s when one has a scale of29. (#619)
None
during JSON deserialization instead ofpanicking. (#607)
Changed
borsh
to version1.1
as a result ofa security advisory. (#621)
Credit
Thank you to @gai6948 for their contribution! Also thank you to all of those that pushed
for the security advisory changes.
1.32.0
Fixed
is_integer
returning incorrect results for mantissa's 10^n where n >=10. (#605)
Changed
byteorder
is no longer required as a dependency for the postgresfeature. (#603)
Credit
Thank you to @psychon for your contribution!
1.31.0
Fixed
trunc_with_scale
implicitly rounding in somescenarios (#600)
Changed
Credit
Thank you to @mkatychev for your contribution this release.
1.30.0
As the minor releases for Rust Decimal are getting smaller, I'll be looking at formally starting version 2 of the
Decimal library. This will be unstable as we find experiment with a new API and address some of the constraints the
current
implementation of the library has (e.g. revised error types for better const support).
Added
proptest
feature support forDecimal
(#582).is_integer
function for an efficient means to check whether aDecimal
is an integer with nofractional portion. (#591).
Changed
Credit
Thank you to @cardoe for your contribution!
1.29.1
Fixed
checked_cos
andchecked_sin
whereQUARTER_PI
would send the calculation into an infiniteloop. (#585)
1.29.0
Added
trunc_with_scale
function which allows you to truncate a decimal number whilst retaining a specifiedprecision. (#576), (#578)
Fixed
Decimal
number to enter into an invalid state. (#575)
Changed
There were also a couple of housekeeping tasks, to help pave the way for v2 of Rust Decimal.
cargo.toml
and leverage the newdep:
syntax whererequired. (#579)
Credit
Thank you @c410-f3r and @jon-chuang for your
contributions to this release!
1.28.1
Fixed
borsh
andcriterion
dependencies to the latestversions. (#568)
serde-with-str
feature. (#571)
Thanks @attila-lin for your help bumping dependencies.
1.28.0
Added
TryFrom<&str>
forDecimal
(#560)Fixed
Option<Decimal>
whenusing
serde-with-str
(#565)rescale
preventingDecimal::ZERO
to be rescaled to an invalidprecision (#566)
Credit
Thank you to @c410-f3r for your diligent help adding features to this library!
1.27.0
Added
Copy
/Clone
traits forrkvy::Archive
(#539)formatting (#555, #557)
Fixed
round (#541)
Changed
cargo-edit
instructions (#538)deserialize_any
except in explicit usecases (#558)
Credit
This release wouldn't have been possible without the help of the community. Special call out and thank you
to @icy-ux, @CAD97, @nicksenger,
@c410-f3r and @yongqli.
1.26.1
Fixed
docs.rs
failing to compile due to mutuallyexclusive
diesel1
anddiesel2
features. The previouscompile_error!
was in fact an anti-pattern.
Consequently,
if both
diesel1
anddiesel2
features are specified then it will favordiesel2
. This helps prevent any conflictscenarios
and ultimately resolves the downstream
docs.rs
issue.1.26.0
Added
serde-with-*
features now supportOption<T>
variants (#524).core::iter::Product
(#525).2.0.0-rc.1
support viadb-diesel2-mysql
anddb-diesel2-postgres
features. (#533
and (#532)).
Fixed
from_str
when parsingDecimal::MAX
with a fractionalportion. (#530).
Credit
Thank you to @Guara92 who made the initial
diesel2
PR which made parallel implementationa breeze! Also, once again, thank you
to @c410-f3r for implementing the missing
Product
trait!1.25.0
Added
rand
support to implementSampleUniform
to allow forrng.gen_range
calls (#519)
rkyv
framework support for zero-cost (de)serialization (#520)
A big thank you to @lukesneeringer and @dovahcrow
for your help building
features for this release.
1.24.0
rand
which allows for random number generationwithin
rust_decimal
(#517).speed (#513, #516)
possible (#503, #504).
A big thank you to @c410-f3r for their contributions to this release!
1.23.1
Fixes issue with
no_std
compatability introducedin
1.23.0
(#501).1.23.0
BorschSchema
support for theborsh
feature (#498).TryFrom
for Decimal primitive types (#493).to_i64
to supporti64::MIN
(#496).Inv
fromnum_traits
(#495).tasks (#487, #490).
Thank you @turion, @arthurprs
and @jnitard for your help with this release.
1.22.0
borsh
serialization/deserialization (#478).serde-with-str
where it wasn't behaving the same asserde-str
whenusing
bincode
(#484).must_use
tois_sign_negative
andunpack
(#482).Thank you @jkbpvsc for your help in this release.
1.21.0
saturating_add
,saturating_sub
and
saturating_mul
(#464)log10
values0 < x < 1
(#469)Thank you @c410-f3r for your work in this release!
1.20.0
from_str
is now over 4x faster, utilizing const generics andTCO (#456)
from_str
issue with rounding issues when too many digits in sourcestring. (#453)
serde-with
functionality for greater configurability whenusing
serde
(#459)This is truly a collaborative release and has some significant contributions from the community. A huge thank
you to everyone involved:
1.19.0
This is a minor dot release and contains library updates (#334) and
expanded scope in
prelude
to includenum_traits::Signed
(#450).While subtle, it also expands the way towards some bigger improvements including variable precision.
Of a larger note, the minimum Rust compiler version has been updated so we can start utilizing various compiler features
(such as const generics). The miminum compiler version is now
1.51.0
.Thank you to @c410-f3r and @jracollins for your
contributions
to this release.
1.18.0
to_f64
when scale is setto
0
. #443.Thank you @anatols for creating this fix.
flag
rocket-traits
. #445.Thank you @Misterio77 for putting this together.
flag
db-diesel-mysq
. #446.1.17.0
30. #428.
deserialize
so that invalid scale values cannot be set. This may be a breaking change for some usersleveraging
this in a
const
function. #428.round_sf
whereby integral values that started with a 0 or 1 would output incorrect roundednumbers. #430, #437.
from_f32_retain
andfrom_f64_retain
functions which allow parsing a floating point number and retaining anyexcess precision. #438.
1.16.0
sin
/cos
/tan
functions which are enabled within themaths
feature. #413.
round_sf
andround_sf_with_strategy
to enable significant figurerounding. #421
std
feature fromarrayvec
usage #417.#415, #416,
#418.
Thank you to @c410-f3r for all your help with fuzz and benchmarking improvements!
1.15.0
A minor bug and feature release which adds a couple of new functions as well as cleans up some documentation:
serde-arbitrary-precision
feature.#402.
Thanks @JamesHinshelwood!
for finding and fixing this!
log10
support to themaths
feature. Please note thatln
andlog10
will now panic on invalid input sinceboth
functions have a
checked_*
equivalent. This is the preferred approach going forward, however if you would like tore-enable
the previous behavior please use the
maths-nopanic
feature. #397.
Decimal
library includingTWO
,TEN
,ONE_HUNDRED
,ONE_THOUSAND
,and
NEGATIVE_ONE
.#400.
-0
whereby-
would beoutput #406. Thanks
@edwardycl!
to_f64
. #401.BUILD.md
file to help people get set up with Rust Decimal locally and cleaned up somedocumentation examples.
1.14.3
Fixes an issue #398 where
Decimal::ZERO.ln()
would panic ratherthan returning
Decimal::ZERO
. Thisaligns the behavior with calling
ln
on negative decimals.Thank you to @SebRollen for finding and fixing this.
1.14.2
Fixes an overflow issue during division under some specific
circumstances. (#392)
1.14.1
A bug fix release following on from
1.14.0
:Decimal
a negating overflow would occur duringunderflow.
#384. Thank you to @c410-f3r for
finding
this as part of fuzz testing.
exp
whereby negative values lost accuracy due to inability to converge.#378. Thank you to @schungx for
finding this and proposing a fix.
1.14.0
checked_exp
andchecked_norm_pdf
functions #375.rounding. #377
Thank you to @falsetru, @schungx
and @blasrodri for your
help with this release!
1.13.0
This is a minor update to the library providing a few new features and one breaking change (I'm not using semver
properly here
sorry).
#[must_use]
added to functions to provide additional compiler hints.try_from_i128_with_scale
function added to safely handlei128
overflow errors.c-repr
feature added which will ensure that#[repr(C)]
is used on theDecimal
type.Thanks @jean-airoldie.
from_scientific
. It now supports a wider range of values as well has slightly fasterperformance.
pow
functions. This is breaking sincepowi(u64)
has been renamedto
powi(i64)
. If you want tocontinue using
u64
arguments then please usepowu(u64)
. The fractional functions should be considered experimentalfor the time being
and may have subtle issues that still need ironing out. Functions are now:
powi
,checked_powi
- When the exponent is a signed integer.powu
,checked_powu
- When the exponent is an unsigned integer.powf
,checked_powf
- When the exponent is a floating point number. Please note, numbers with a fractionalcomponent
will use an approximation function.
powd
,checked_powd
- When the exponent is aDecimal
. Please note, numbers with a fractional component willuse
an approximation function.
1.12.4
Adds
num_traits::One
back torust_decimal::prelude
to prevent unnecessary downstream dependency breakages.Thanks @spearman.
1.12.3
Fixes an issue #361 when rounding a small number towards zero.
1.12.2
Fixes small regression whereby
0 - 0
was producing-0
. Thankyou @KonishchevDmitry for
providing a swift fix (#356).
1.12.1
Added
num_traits::Zero
back torust_decimal::prelude
to prevent unnecessary downstream dependency breakages.1.12.0
This version releases faster operation support for
add
,sub
,cmp
,rem
andmul
to match the reneweddiv
strategy.
It does this by leveraging 64 bit support when it makes sense, while attempting to still keep 32 bit optimizations in
place.
To ensure correct functionality, thousands more tests were included to cover a wide variety of different scenarios
and bit combinations. Compared to previous operations, we get the following speed improvements:
add
- up to 2.2x fasterdiv
- up to 428x fastermul
- up to 1.8x fasterrem
- up to 1.08x fastersub
- up to 2.5x fasterOf course, if old functionality is desired, it can be re-enabled by using the
legacy-ops
feature.Other improvements include:
String
allocation when parsing a scientific number format.Thanks @thomcc for the fix #350.
sqrt
when using the smallest possible representablenumber. #349.
maths
feature. Future work will involve speeding up this feature by keepingoperations
in an internal format until required.
MIN
,MAX
andZERO
. Deprecatedmin_value()
andmax_value()
in favor of thesenew
constants.
-0
now gets corrected to0
. During operation rewrite I needed to consider operations such as-0 * 2
- in caseslike
this I opted towards
0
always being the right number and-0
being superfluous (since+0 == -0
). Consequently,parsing
-0
etc in general will automatically be parsed as0
. Of course, this may be a breaking change so if thisfunctionality is required then please create an issue with the use case described.
is_negative
tonegative
inUnpackedDecimal
.1.11.1
This is a documentation only release and has no new functionality included. Thank
you @c410-f3r for the documentation fix.
1.11.0
This release includes a number of bug fixes and ergonomic improvements.
log
andpow
are not required (e.g. simple financial applications). Mathematical functionality is now behindthe
maths
feature flag. #321.
coverage. #322,
#323
improvements. #324, #342
u128
andi128
parsing. #332Checked*
traits fromnum_traits
. #333. Thank you@teoxoy
checked_powi
function tomaths
feature. #336from_parts
to avoid accidental scale clobbering. #337Arbitrary
trait forrust-fuzz
support. This is behind the feature flagrust-fuzz
.#338
e^-1
returning an incorrect approximation. #339RoundingStrategy
naming and documentation (#340).The old naming was ambiguous in interpretation - the new naming
convention follows guidance from other libraries to ensure an easy to follow scheme. The
RoundingStrategy
enum nowincludes:
MidpointNearestEven
(previouslyBankersRounding
)MidpointAwayFromZero
(previouslyRoundHalfUp
)MidpointTowardZero
(previouslyRoundHalfDown
)ToZero
(previouslyRoundDown
)AwayFromZero
(previouslyRoundUp
)ToNegativeInfinity
- new rounding strategyToPositiveInfinity
- new rounding strategymantissa
directly. #341rust_decimal_macros
to make re-exporting the macro from a downstream crate more approachable.Enabling the
reexportable
feature will ensure that the generated code doesn't requirerust_decimal
to be exposedat
the root level. #343
1.10.3
1.10.2
#314).
1.10.1
neg
whereby sign would always be turned negative as opposed to being correctly negated.Thank you KonishchevDmitry for finding and fixing this.
1.10.0
postgres
to0.19
andtokio-postgres
to0.7
.serde
serialization by preventing heap allocation.default,
but can be disabled with the feature:
legacy-ops
. Further work to improve other operations willbe made available in future versions.
TryFrom
forf32
/f64
to/from DecimalThank you for the the community help and support for making this release happen, in particular:
jean-airoldie, gakonst, okaneco
and
c410-f3r.
1.9.0
serde_json
deserialization (#283)u128
andi128
FromPrimitive
overrides to prevent default implementation kicking in. Also adds defaultFrom
interceptors to avoid having to use trait directly. (#282)
serde-bincode
asserde-str
to make usage clearer (#279)UpperExp
andLowerExp
traits. (#271)tokio-postgres
andpostgres
libraries.powi
,sqrt
,exp
,norm_cdf
,norm_pdf
,ln
&erf
(#281, #287)sum
across immutable references (#280)Thank you for all the community help and support with this release, in particular xilec,
remkade and Anders429.
1.8.1
Make
std
support the default to prevent breaking downstream library dependencies. To enableno_std
support pleaseset
default features to false and opt-in to any required components. e.g.
1.8.0
no_std
support added to Rust Decimal by default.std
isn't required to use Rust Decimal, however can be enabled byusing the
std
feature. #190through
to_f64
. #267.Clone
,Copy
,PartialEq
andEq
derives toRoundingStrategy
.Thank you to @c410-f3r, @smessmer
and @KiChjang.
1.7.0
bincode
support via the featureserde-bincode
. This provides a long term fix for a regressionthat was introduced in version
0.6.5
(tests now cover thiscase!). Issue 43.
rescale
on zero would not have an affect. This was due to an early exit condition which failed toset the new scale. Issue 253.
min
andmax
functions, similar to whatf32
andf64
provide. Thankyou @michalsieron.
is_sign_positive
andis_sign_negative
to specify that the sign bit is being checked.Please note: feature naming conventions have been modified, however backwards compatible aliases have been created where
necessary. It's highly recommended that you move over to the new naming conventions as these aliases may be removed at a
later date.
1.6.0
outputs. Issue 241.
from_str_radix
whereby rounding logic would kick in too early,especially with radix less than 10. Issue 242.
from_str
(implicityfrom_str_radix
) would panic when there was overflowand overflow significant digit was < 5. Issue 246.
bytes
andbyteorder
optional since they're only used in thepostgres
feature and tests.from_i128_with_scale
wheni128::MIN
was provided.Thank you
to @serejkaaa512, @AbsurdlySuspicious
and @0e4ef622 for your contributions!
1.5.0
RoundStrategy
abilities:RoundUp
to always round up andRoundDown
to always round down.Special thank you to @jean-airoldie for adding the additional rounding strategies
and to @pfrenssen for fixing an
issue in the README.
1.4.1
to_f64
when using a scale > 0.Special thank you to @hengchu who discovered and resolved the issue!
1.4.0
dec!
macro.set_sign
and replace withset_sign_positive
andset_sign_negative
. This is intendedto improve the readability of the API.
f64
values. The base 2 mantissa of the float was assuming guaranteed accuracyof 53 bit precision, however 52 bit precision is more accurate (
f64
only).Error::description
.1.3.0
num
dependency withnum_trait
- implementedSigned
andNum
traits.1.2.1
handles this by rounding high precision numbers as they're read as opposed to crashing (similar to other
underflow situations e.g. 1/3).
1.2.0
type.
k1 == k2 -> hash(k1) == hash(k2)
Special thanks to @hathawsh for their help in this release!
1.1.0
tokio-pg
serde-float
Special thanks to @pimeys and @kaibyao!
1.0.3
Updates dependencies to prevent build issues.
1.0.2
Bug fix release:
@KonishchevDmitry!
1.0.1
Bug fix release:
ToSql
was incorrectly calculating weight when whole portion = numeric portion.Decimal::new
incorrectly handledi64::max_value()
andi64::min_value()
.rem
operation incorrectly returned results whenscale
was required.1.0.0
This release represents the start of semantic versioning and allows the library to start making fundamental improvements
under
the guise of V2.0. Leading up to that I expect to release 1.x versions which will include adding
various mathematical functions such as
pow
,ln
,log10
etc.Version
1.0.0
does come with some new features:checked_add
,checked_sub
,checked_mul
,checked_div
andchecked_rem
.max_value()
andmin_value()
fori32
andi64
.Special thanks to @0e4ef622 for their help with this release!
0.11.3
use rust_decimal::prelude::*
)Default
trait to the library. This is equivalent to usingDecimal::zero()
Special thanks to @jean-airoldie for his help with this release!
0.11.2
from_scientific
whenfrom_str
fails during deserialization. Thanks @mattjbray!Sum
trait implementation0.11.1
floor
andceil
where negative numbers were incorrectly handled.0.11.0
meantime
so due diligence is required before usage.
const_fn
support via a feature flag. In the future this will be the default option however in order to support oldercompiler versions is behind a feature flag.
0.10.2
results in some minor performance improvements. Also, removed feature gate so that it can be compiled in stable.
0.10.1
0.10.0
Special thanks to @xilec, @snd and @AndrewSpeed for their help with this release.
round_dp_with_strategy
. Previously default rounding support used bankersrounding by default whereas now you can choose to round the half way point either up or down.
Debug
trait now outputs the actual decimal number by default to make it more useful within consuming libraries (e.g.
criterion.rs
). To get something similar to the previous functionality you can use theunpack
argument - thisis likely for core
rust-decimal
library maintainers.rescale
,sub
anddiv
.0.9.1
add
.0.9.0
Neg
trait to support the ability to use-decimal_variable
.0.8.1
This release updates the published documentation only and is a no-op for functionality.
0.8.0
from_scientific
allowing parsing of scientific notation into the Decimal type.0.7.2
rescale
whereby scaling which invoked rounding incorrectly set the new scale for the left/right sides.0.7.1
cmp
whereby two negatives would return an incorrect result.abs
,floor
andceil
functions.0.7.0
This is a minor version bump as we slowly build our way towards 1.0. Thank you for everyone's support and help as we get
there! This has a few notable changes - also introducing a few new interfaces which is the reason for the version bump:
from_parts
function to allow effective creation ofDecimal
's without requiring binary serialization. An example ofthis benefit is with the lazy static group initializers for Postgres.
normalize
function to allow stripping trailing zero's easily.trunc
function allows truncation of a number without any rounding. This effectively "truncates" the fractional partof the number.
fract
function returns the fractional part of the number without the integral._
would cause numbers to be incorrectly identified.mul
. Numbers utilizing thelo
portion of the decimal only will now be shortcut and biggernumbers will now correctly overflow. True overflows will still panic, however large underflows will now be rounded as
necessary as opposed to panicing.
Hash
was implemented by convention in0.6.5
however is reimplemented explicitly in0.7.0
for effectiveness.normalize
(i.e. avoiding strings). Furtheroptimizations can be made in write however require some
div
optimizations first.a performance hit on Travis builds however hopefully the pay off will make it worthwhile.
0.6.5
Fixes issue with rescale sometimes causing a silent overflow which led to incorrect results during addition, subtraction
and compare. Consequently Decimal now rounds the most significant number so that these operations work successfully.
In addition, Decimal now derive's the
Hash
trait so that it can be used for indexing.0.6.4
Fixes silent overflow errors when parsing highly significant strings.
from_str
will now round in these scenario's,similar to oleaut32 behavior.
0.6.3
Fixes a regression in ordering where by different scales would be rescaled towards losing precision instead of
increasing precision. Have added numerous test suites to help cover more issues like this in the future.
Also fixes an issue in parsing invalid strings whereby the precision exceeded our maximum precision. Previously, this
would work with unintended results however this now returns an Error returned from
FromStr
.0.6.2
Fixes an issue with division of rational numbers allowing results greater than
MAX_PRECISION
. This would ultimatelycause issues for future operations on this number.
In addition, in some cases transitive operations would not be equal due to overflow being lost.
0.6.1
This minor release is purely to expose
rust_decimal_macros
for use on the nightly channel. Documentation has beenupdated accordingly.
0.6.0
This release has a few major changes to the internal workings of the
Decimal
implementation and consequently comeswith a number of performance improvements.
Decimal
type usingfrom_f32
andfrom_f64
.add
,sub
,mul
run roughly 1500% faster than before.div
run's roughly 1000% faster than before with room for future improvement.cmp
,rescale
,round_dp
and some string manipulations.*Assign
traits for simpler usage.BigInt
andBigUint
as being intermediary data types.0.5.2
Minor bug fix to prevent a
panic
from overflow during comparison of high significant digit decimals.0.5.1
Minor bux fix to prevent
panic
upon parsing an empty string.0.5.0
bincode
support for serde0.4.2
Fixes bug in
cmp
whereby negative's were not being compared correctly.0.4.1
Minor bug fix to support creating negative numbers using the default constructor.
0.4.0
This release is a stylistic cleanup however does include some minor changes that may break existing builds.
Changed
features
using the keywordserde
.0
.f64
conversion support has been added.0.3.1
This is a documentation release that should help with discoverability and usage.
0.3.0
Changed
ToDecimal
and replaced with builtinFrom
trait (
#12
)Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate. View repository job log here.