샘플
@xtuc/ieee754 1.2.0: read and write IEEE754 floating point numbers
검증된 샘플 — npm @xtuc/ieee754 1.2.0: read and write IEEE754 floating point numbers. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다.
sha256:49697b6e94b60f72f906475d8e1b9e8c0222e84d506ccf44a343cbf5f29b7c2a
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
linux 24 · ubuntu · glibc 2.39 x64 npm
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-27 |
케이스
HOW- 목표
- read and write IEEE754 floating point numbers
- 심벌
-
- @xtuc/ieee754.read
- @xtuc/ieee754.write
- 생성일
- 2026-08-27T23:36:10Z
컨트랙트
- exports read and write functions from @xtuc/ieee754 module
- writes and reads 32-bit single precision floats in little-endian format with mLen=23 and nBytes=4
- writes and reads 32-bit single precision floats in big-endian format with mLen=23 and nBytes=4
- writes and reads 64-bit double precision floats in little-endian format with mLen=52 and nBytes=8
- writes and reads 64-bit double precision floats in big-endian format with mLen=52 and nBytes=8
- encodes and decodes special IEEE754 values including positive and negative zero, infinity, and NaN
파일
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
소스
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: read and write IEEE754 floating point numbers
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40xtuc/ieee754@1.2.0
Demonstrate these symbols/APIs:
- @xtuc/ieee754.read
- @xtuc/ieee754.write
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:9526910d2b6748024ea54c6ed943ab95408d1b668a1b02e3f2d2361126c7d0ec","contract":["exports read and write functions from @xtuc/ieee754 module","writes and reads 32-bit single precision floats in little-endian format with mLen=23 and nBytes=4","writes and reads 32-bit single precision floats in big-endian format with mLen=23 and nBytes=4","writes and reads 64-bit double precision floats in little-endian format with mLen=52 and nBytes=8","writes and reads 64-bit double precision floats in big-endian format with mLen=52 and nBytes=8","encodes and decodes special IEEE754 values including positive and negative zero, infinity, and NaN"],"goal":"read and write IEEE754 floating point numbers","kind":"HOW","packages":["pkg:npm/%40xtuc/ieee754@1.2.0"],"schemaVersion":1,"symbols":["@xtuc/ieee754.read","@xtuc/ieee754.write"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/%40xtuc/ieee754@1.2.0"],"schemaVersion":1,"subject":"pkg:npm/%40xtuc/ieee754@1.2.0","symbols":["@xtuc/ieee754.read","@xtuc/ieee754.write"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-xtuc-ieee754-read-write",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-xtuc-ieee754-read-write",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"@xtuc/ieee754": "1.2.0"
}
},
"node_modules/@xtuc/ieee754": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz",
"integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==",
"license": "BSD-3-Clause"
}
}
}
{
"name": "sample-xtuc-ieee754-read-write",
"version": "1.0.0",
"private": true,
"type": "module",
"license": "MIT-0",
"dependencies": {
"@xtuc/ieee754": "1.2.0"
}
}
{
"schemaVersion": 1,
"goal": "read and write IEEE754 floating point numbers",
"kind": "HOW",
"packages": [
"pkg:npm/%40xtuc/ieee754@1.2.0"
],
"symbols": [
"@xtuc/ieee754.read",
"@xtuc/ieee754.write"
]
}
import assert from 'node:assert/strict';
import { read, write } from '@xtuc/ieee754';
import * as ieee754Module from '@xtuc/ieee754';
// 1. Verify module exports
assert.equal(typeof read, 'function', 'read must be a function');
assert.equal(typeof write, 'function', 'write must be a function');
assert.equal(typeof ieee754Module.read, 'function', 'read must be exported');
assert.equal(typeof ieee754Module.write, 'function', 'write must be exported');
// 2. 32-bit float Little Endian (mLen=23, nBytes=4)
{
const buf = Buffer.alloc(4);
const testVal = 42.5;
write(buf, testVal, 0, true, 23, 4);
const result = read(buf, 0, true, 23, 4);
assert.equal(result, testVal, '32-bit float LE must round-trip correctly');
}
// 3. 32-bit float Big Endian (mLen=23, nBytes=4)
{
const buf = Buffer.alloc(4);
const testVal = -42.5;
write(buf, testVal, 0, false, 23, 4);
const result = read(buf, 0, false, 23, 4);
assert.equal(result, testVal, '32-bit float BE must round-trip correctly');
}
// 4. 64-bit float Little Endian (mLen=52, nBytes=8)
{
const buf = Buffer.alloc(8);
const testVal = 3.141592653589793;
write(buf, testVal, 0, true, 52, 8);
const result = read(buf, 0, true, 52, 8);
assert.equal(result, testVal, '64-bit float LE must round-trip correctly');
}
// 5. 64-bit float Big Endian (mLen=52, nBytes=8)
{
const buf = Buffer.alloc(8);
const testVal = -1234567.890123456;
write(buf, testVal, 0, false, 52, 8);
const result = read(buf, 0, false, 52, 8);
assert.equal(result, testVal, '64-bit float BE must round-trip correctly');
}
// 6. Special IEEE 754 values (+0, -0, +Infinity, -Infinity, NaN)
{
const buf = Buffer.alloc(40);
// +0
write(buf, 0, 0, true, 52, 8);
assert.equal(Object.is(read(buf, 0, true, 52, 8), +0), true, '+0 must be preserved');
// -0
write(buf, -0, 8, true, 52, 8);
assert.equal(Object.is(read(buf, 8, true, 52, 8), -0), true, '-0 must be preserved');
// +Infinity
write(buf, Infinity, 16, true, 52, 8);
assert.equal(read(buf, 16, true, 52, 8), Infinity, '+Infinity must be preserved');
// -Infinity
write(buf, -Infinity, 24, true, 52, 8);
assert.equal(read(buf, 24, true, 52, 8), -Infinity, '-Infinity must be preserved');
// NaN
write(buf, NaN, 32, true, 52, 8);
assert.equal(Number.isNaN(read(buf, 32, true, 52, 8)), true, 'NaN must be preserved');
}
console.log('Contract passed: read and write in pkg:npm/@xtuc/ieee754@1.2.0 successfully verified');
오리진 시더
익명