CodeSampleX

サンプル

github.com/shopspring/decimal 1.4.0: Perform exact half-to-even banker's rounding, cash rounding at standard currency intervals, and precision-controlled division in github.com/shopspring/decimal

検証済みサンプル — golang github.com/shopspring/decimal 1.4.0: Perform exact half-to-even banker's rounding, cash rounding at standard currency intervals, and…

sha256:6ac1eb0ab7ba89290385ea779dece795806016d89e5d1c663f571b08a50f4f6d

このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。 合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。 MIT-0

実行証拠

宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。

証拠の基準
署名済みコントラクト合格
検証レシート
2
ビルドした署名鍵
2
宣言された環境 go linux x64 go go go

検証実行環境

環境 コントラクト ステージ 実行日
go 1.26 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · golang@1
2026-08-17
go 1.26 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · golang@1
2026-08-18

ケース

HOW
ゴール
Perform exact half-to-even banker's rounding, cash rounding at standard currency intervals, and precision-controlled division in github.com/shopspring/decimal
パッケージ
シンボル
  • decimal.Decimal.RoundBank
  • decimal.Decimal.Round
  • decimal.Decimal.RoundCash
  • decimal.Decimal.StringFixedBank
  • decimal.Decimal.DivRound
  • decimal.Decimal.Truncate
環境
go
作成日
2026-08-17T20:32:46Z

コントラクト

  1. decimal.Decimal.RoundBank rounds to the nearest even number when equidistant and rounds integer powers when places is negative, whereas Round rounds half away from zero
  2. assert decimal.Decimal.StringFixedBank and StringFixed format rounded strings with exact decimal place zero padding
  3. assert decimal.Decimal.RoundCash rounds to intervals of 5, 10, 25, 50, or 100 cents and panics on unsupported intervals
  4. assert decimal.Decimal.DivRound divides and rounds quotient to specified decimal places whereas Div uses DivisionPrecision
  5. assert decimal.Decimal.Truncate strips digits beyond specified precision without rounding

ファイル

  • NOTES.md
  • csx.json
  • decimal_test.go
  • go.mod
  • go.sum

ソースアーティファクトをダウンロード (tar.gz)

オリジンシーダー

csx-seed