# Log-specific write-counter arithmetic

Synthetic examples only. Not an endurance experiment or failure predictor.
Run with Node.js:

```js
import { writtenBucket } from "./written-bucket.mjs";
console.log(writtenBucket("1000", "02h"));
console.log(writtenBucket("1000", "09h"));
```

Outputs are decimal-string byte bounds, exclusive lower and inclusive upper.
Zero returns null (not reported), not an empty workload. Inputs must be unsigned
128-bit integers, with explicit log identifier. Unsafe Number inputs are rejected.
For SMART 02h the quantum is 512000 bytes; for Endurance Group 09h it is
1000000000 bytes. Counters round up, so these are buckets, not exact totals.
The module does not compare devices, combine scopes or calculate wear probability.
Keep device identity and Endurance Group ID outside this pure arithmetic function.

Source: NVMe Base 2.3 Figure 210, p. 215 and Figure 222, p. 232:
https://nvmexpress.org/wp-content/uploads/NVM-Express-Base-Specification-Revision-2.3-2025.08.01-Ratified.pdf
Reviewed 2026-10-15. No third-party data or figures redistributed.
