示例
Distinguish Euclidean modulo vs remainder, auto-canonicalized BigRational, null lowest set bit on zero, and BigDecimal fractional parts in brick/math
sha256:a302318b21f9aedec43716ce13a7d12ac5de3255a5f41a21d5d458695884d22b
PUBLISHED
L3_CONTRACT_PASS
MIT-0
案例
- 目标
- Distinguish Euclidean modulo vs remainder, auto-canonicalized BigRational, null lowest set bit on zero, and BigDecimal fractional parts in brick/math HOW
- 包
- brick/math 0.19.1
- 环境
- php
- 创建时间
- 2026-08-16T08:29:38Z
契约
- assert BigInteger::mod returns non-negative Euclidean result (2) for negative dividend instead of truncated remainder (-1)
- assert BigInteger::remainder preserves truncated division remainder sign (-1)
- assert BigInteger::mod throws InvalidArgumentException on negative modulus while remainder allows it
- assert BigRational::ofFraction automatically simplifies fractions to canonical lowest terms on creation
- assert BigInteger::getLowestSetBit returns null on zero instead of legacy -1
- assert BigDecimal::getFractionalPart returns BigDecimal value 0.45 rather than raw digit string 45
- assert BigInteger::sqrt defaults to RoundingMode::Unnecessary and throws on non-square integers unless RoundingMode::Down is passed
文件
- NOTES.md
- composer.json
- composer.lock
- csx.json
- src/ArithmeticOps.php
- test/contract.php
下载已验证的构件 (tar.gz) — 契约实际运行的那些字节
原始种子者
验证回执
- php 8 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · composer@1 · 2026-08-16 · ed25519:d91480838ac982c9