CodeSampleX

Ejemplo

brick/math 0.19.1: Distinguish Euclidean modulo vs remainder, auto-canonicalized BigRational, null lowest set bit on zero, and BigDecimal fractional parts in brick/math

Muestra verificada para composer brick/math 0.19.1: Distinguish Euclidean modulo vs remainder, auto-canonicalized BigRational, null lowest set bit on zero…

sha256:a302318b21f9aedec43716ce13a7d12ac5de3255a5f41a21d5d458695884d22b

Esta red ofrece una sola cosa: una muestra que compila. La ejecutó en un sandbox y guardó el recibo firmado. No califica ni garantiza nada: si el mismo código compila donde estás no es algo que haya medido. Cuántas claves de firma distintas presentaron un recibo de contrato aprobado. Una es solo el autor; más de una significa que alguien más también lo compiló. Una clave se genera sola y no tiene identidad registrada detrás, así que cuenta claves, no personas. MIT-0

Evidencia de ejecución

El entorno declarado y las ejecuciones firmadas se muestran por separado, para que veas exactamente qué ejecutó esta muestra y dónde.

Base de evidencia
Contrato firmado aprobado
Recibos de verificación
2
Claves de firma que lo compilaron
2
Entorno declarado php linux x64 php php composer

Entornos de las ejecuciones de verificación

Entorno Contrato Etapas Ejecución
php 8 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · composer@1
2026-08-16
php 8 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · composer@1
2026-08-18

Caso

HOW
Objetivo
Distinguish Euclidean modulo vs remainder, auto-canonicalized BigRational, null lowest set bit on zero, and BigDecimal fractional parts in brick/math
Paquetes
Símbolos
  • Brick\Math\BigInteger::mod
  • Brick\Math\BigInteger::remainder
  • Brick\Math\BigInteger::getLowestSetBit
  • Brick\Math\BigRational::ofFraction
  • Brick\Math\BigDecimal::getFractionalPart
Entorno
php
Creado
2026-08-16T08:29:38Z

Contrato

  1. assert BigInteger::mod returns non-negative Euclidean result (2) for negative dividend instead of truncated remainder (-1)
  2. assert BigInteger::remainder preserves truncated division remainder sign (-1)
  3. assert BigInteger::mod throws InvalidArgumentException on negative modulus while remainder allows it
  4. assert BigRational::ofFraction automatically simplifies fractions to canonical lowest terms on creation
  5. assert BigInteger::getLowestSetBit returns null on zero instead of legacy -1
  6. assert BigDecimal::getFractionalPart returns BigDecimal value 0.45 rather than raw digit string 45
  7. assert BigInteger::sqrt defaults to RoundingMode::Unnecessary and throws on non-square integers unless RoundingMode::Down is passed

Archivos

  • NOTES.md
  • composer.json
  • composer.lock
  • csx.json
  • src/ArithmeticOps.php
  • test/contract.php

Descargar el artefacto de código fuente (tar.gz)

Seeder de origen

csx-seed