NewFromString and UnmarshalBinary, and so JSON, text, SQL, gob and Spanner decoding, reject exponents larger than the new MaxDecodeExponent setting (default 10,000). Such input could hang the process or use gigabytes of memory. Raise MaxDecodeExponent if you need larger exponents #440
Pow, PowWithPrecision, PowInt32 and PowBigInt round correctly. Results for fractional exponents have PowPrecisionNegativeExponent (16) decimal places, and negative powers that used to return 0 keep 16 significant digits, so 10^-18 is 0.000000000000000001. Results too large to represent return an error, or 0 from Pow, instead of hanging or panicking #439
RoundUp, RoundDown, RoundCeil and RoundFloor always return exponent -places, like Round. Values don't change, but Exponent(), Coefficient() and String() with TrimTrailingZeros = false can #426#441
Truncate supports negative precision: 5432 truncated to -2 is 5400. Before, it returned 5432 unchanged #426
Shift panics when the exponent overflows an int32, instead of wrapping around #437
NewFromString rejects a sign right after a leading decimal point, such as ".-5"#447
FEATURES
Add TrimTrailingZeros and UseScientificNotation settings for string output #389#416
Add Spanner support with EncodeSpanner and DecodeSpanner for Decimal and NullDecimal#395
This PR contains the following updates:
| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [github.com/shopspring/decimal](https://github.com/shopspring/decimal) | `v1.4.0` → `v1.5.0` |  |  |
---
### Release Notes
<details>
<summary>shopspring/decimal (github.com/shopspring/decimal)</summary>
### [`v1.5.0`](https://github.com/shopspring/decimal/blob/HEAD/CHANGELOG.md#Decimal-v150)
[Compare Source](https://github.com/shopspring/decimal/compare/v1.4.0...v1.5.0)
##### BEHAVIOR CHANGES
- `NewFromString` and `UnmarshalBinary`, and so JSON, text, SQL, gob and Spanner decoding, reject exponents larger than the new `MaxDecodeExponent` setting (default 10,000). Such input could hang the process or use gigabytes of memory. Raise `MaxDecodeExponent` if you need larger exponents [#​440](https://github.com/shopspring/decimal/pull/440)
- `Pow`, `PowWithPrecision`, `PowInt32` and `PowBigInt` round correctly. Results for fractional exponents have `PowPrecisionNegativeExponent` (16) decimal places, and negative powers that used to return 0 keep 16 significant digits, so `10^-18` is `0.000000000000000001`. Results too large to represent return an error, or 0 from `Pow`, instead of hanging or panicking [#​439](https://github.com/shopspring/decimal/pull/439)
- `RoundUp`, `RoundDown`, `RoundCeil` and `RoundFloor` always return exponent `-places`, like `Round`. Values don't change, but `Exponent()`, `Coefficient()` and `String()` with `TrimTrailingZeros = false` can [#​426](https://github.com/shopspring/decimal/pull/426) [#​441](https://github.com/shopspring/decimal/pull/441)
- `Truncate` supports negative precision: `5432` truncated to `-2` is `5400`. Before, it returned `5432` unchanged [#​426](https://github.com/shopspring/decimal/pull/426)
- `Shift` panics when the exponent overflows an int32, instead of wrapping around [#​437](https://github.com/shopspring/decimal/pull/437)
- `NewFromString` rejects a sign right after a leading decimal point, such as `".-5"` [#​447](https://github.com/shopspring/decimal/pull/447)
##### FEATURES
- Add `TrimTrailingZeros` and `UseScientificNotation` settings for string output [#​389](https://github.com/shopspring/decimal/pull/389) [#​416](https://github.com/shopspring/decimal/pull/416)
- Add Spanner support with `EncodeSpanner` and `DecodeSpanner` for `Decimal` and `NullDecimal` [#​395](https://github.com/shopspring/decimal/pull/395)
##### ENHANCEMENTS
- Most operations are faster and allocate less, about twice as fast on average across the benchmarks [#​444](https://github.com/shopspring/decimal/pull/444) [#​445](https://github.com/shopspring/decimal/pull/445) [#​446](https://github.com/shopspring/decimal/pull/446) [#​447](https://github.com/shopspring/decimal/pull/447) [#​448](https://github.com/shopspring/decimal/pull/448) [#​449](https://github.com/shopspring/decimal/pull/449) [#​451](https://github.com/shopspring/decimal/pull/451)
- Faster `UnmarshalJSON`, `Scan` and `NewFromString` [#​403](https://github.com/shopspring/decimal/pull/403)
- `ExpHullAbrham` raises its partial sum to a power by squaring. Large inputs that took minutes now take seconds [#​450](https://github.com/shopspring/decimal/pull/450)
- Document that `NewFromFloat` returns the shortest decimal that converts back to the same float, and how to convert large whole numbers exactly [#​442](https://github.com/shopspring/decimal/pull/442)
- Split `decimal.go` into `decimal.go`, `math.go` and `encoding.go` [#​452](https://github.com/shopspring/decimal/pull/452)
- Lint with golangci-lint in CI, and test on Go 1.26 and 1.27 [#​453](https://github.com/shopspring/decimal/pull/453) [#​454](https://github.com/shopspring/decimal/pull/454)
##### BUGFIXES
- Fix `Float64` hanging on decimals with huge exponents [#​438](https://github.com/shopspring/decimal/pull/438)
- Fix `ExpHullAbrham` returning `10^exp` instead of 1 for tiny inputs [#​433](https://github.com/shopspring/decimal/pull/433)
- Fix a data race in `ExpTaylor` [#​414](https://github.com/shopspring/decimal/pull/414)
- Fix `NumDigits` for some exact powers of ten [#​425](https://github.com/shopspring/decimal/pull/425)
- Fix the `omitzero` struct tag for `Decimal` fields in nested structs [#​415](https://github.com/shopspring/decimal/pull/415)
- Fix `RoundCash` giving wrong results with a low `DivisionPrecision` [#​443](https://github.com/shopspring/decimal/pull/443)
- `NullDecimal` is no longer `Valid` after a failed `Scan`, `UnmarshalJSON` or `DecodeSpanner` [#​443](https://github.com/shopspring/decimal/pull/443)
</details>
---
### Configuration
📅 **Schedule**: (UTC)
- Branch creation
- At any time (no schedule defined)
- Automerge
- At any time (no schedule defined)
🚦 **Automerge**: Enabled.
♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 **Ignore**: Close this PR and you won't be reminded about this update again.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box
---
This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xMzguMCIsInVwZGF0ZWRJblZlciI6IjQ0LjEzOC4wIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIiwibGFiZWxzIjpbImF1dG9tYXRlZCIsImRlcGVuZGVuY2llcyJdfQ==-->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
This PR contains the following updates:
v1.4.0→v1.5.0Release Notes
shopspring/decimal (github.com/shopspring/decimal)
v1.5.0Compare Source
BEHAVIOR CHANGES
NewFromStringandUnmarshalBinary, and so JSON, text, SQL, gob and Spanner decoding, reject exponents larger than the newMaxDecodeExponentsetting (default 10,000). Such input could hang the process or use gigabytes of memory. RaiseMaxDecodeExponentif you need larger exponents #440Pow,PowWithPrecision,PowInt32andPowBigIntround correctly. Results for fractional exponents havePowPrecisionNegativeExponent(16) decimal places, and negative powers that used to return 0 keep 16 significant digits, so10^-18is0.000000000000000001. Results too large to represent return an error, or 0 fromPow, instead of hanging or panicking #439RoundUp,RoundDown,RoundCeilandRoundFlooralways return exponent-places, likeRound. Values don't change, butExponent(),Coefficient()andString()withTrimTrailingZeros = falsecan #426 #441Truncatesupports negative precision:5432truncated to-2is5400. Before, it returned5432unchanged #426Shiftpanics when the exponent overflows an int32, instead of wrapping around #437NewFromStringrejects a sign right after a leading decimal point, such as".-5"#447FEATURES
TrimTrailingZerosandUseScientificNotationsettings for string output #389 #416EncodeSpannerandDecodeSpannerforDecimalandNullDecimal#395ENHANCEMENTS
UnmarshalJSON,ScanandNewFromString#403ExpHullAbrhamraises its partial sum to a power by squaring. Large inputs that took minutes now take seconds #450NewFromFloatreturns the shortest decimal that converts back to the same float, and how to convert large whole numbers exactly #442decimal.gointodecimal.go,math.goandencoding.go#452BUGFIXES
Float64hanging on decimals with huge exponents #438ExpHullAbrhamreturning10^expinstead of 1 for tiny inputs #433ExpTaylor#414NumDigitsfor some exact powers of ten #425omitzerostruct tag forDecimalfields in nested structs #415RoundCashgiving wrong results with a lowDivisionPrecision#443NullDecimalis no longerValidafter a failedScan,UnmarshalJSONorDecodeSpanner#443Configuration
📅 Schedule: (UTC)
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR is behind base branch, 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 CLI.