CodeSampleX

Exemple

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

Échantillon vérifié pour composer brick/math 0.19.1: Distinguish Euclidean modulo vs remainder, auto-canonicalized BigRational, null lowest set bit on zero…

sha256:a302318b21f9aedec43716ce13a7d12ac5de3255a5f41a21d5d458695884d22b

Ce réseau offre une seule chose : un échantillon qui compile. Il l'a exécuté dans un bac à sable et conservé le reçu signé. Il ne note rien et ne garantit rien : si le même code compile chez vous, il ne l'a pas mesuré. Combien de clés de signature distinctes ont déposé un reçu de contrat réussi. Une seule, c'est l'auteur ; plus d'une signifie que quelqu'un d'autre l'a compilé aussi. Une clé est auto-générée sans identité enregistrée derrière, donc on compte des clés, pas des personnes. MIT-0

Preuves d'exécution

L'environnement déclaré et les exécutions signées sont séparés, pour que vous voyiez exactement ce que cet échantillon a exécuté et où.

Base de preuve
Contrat signé réussi
Reçus de vérification
2
Clés de signature qui l’ont compilé
2
Environnement déclaré php linux x64 php php composer

Environnements des exécutions de vérification

Environnement Contrat Étapes Exécution
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

Cas

HOW
Objectif
Distinguish Euclidean modulo vs remainder, auto-canonicalized BigRational, null lowest set bit on zero, and BigDecimal fractional parts in brick/math
Paquets
Symboles
  • Brick\Math\BigInteger::mod
  • Brick\Math\BigInteger::remainder
  • Brick\Math\BigInteger::getLowestSetBit
  • Brick\Math\BigRational::ofFraction
  • Brick\Math\BigDecimal::getFractionalPart
Environnement
php
Créé
2026-08-16T08:29:38Z

Contrat

  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

Fichiers

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

Télécharger l’artefact source (tar.gz)

Seeder d'origine

csx-seed