v136 · javascript
Precision Calculator
Explore the two new capabilities unlocked by Chrome 136's double type for ProgressEvent.loaded and total: fractional progress (0.0–1.0 for AI streaming) and giant file sizes (beyond the old 32-bit 4 GB overflow). Construct custom ProgressEvent instances and verify the values survive the round-trip.
checking ProgressEvent double…
Before Chrome 136,
loaded and total were unsigned long long (integer). Two problems: (1) fractional values like 0.73 were silently truncated to 0, and (2) values above 253 lost precision. Chrome 136 changes both to double, enabling the Writing Assistance API's 0.0–1.0 progress pattern and terabyte-scale uploads.
Fractional progress (AI streaming use case)
Drag the slider to simulate an AI model reporting fractional progress (e.g. tokens generated / total tokens). Before Chrome 136, total = 1 would be truncated to an integer.
loaded=0.370 · total=1 · percentage=37.0%
Custom ProgressEvent constructor
Click "Construct ProgressEvent".
Overflow boundary — where integer type fails
| Value | As unsigned long long (pre-136) | As double (Chrome 136) | Impact |
|---|
The Writing Assistance API pattern
// Before Chrome 136: this would silently lose the fraction
const e = new ProgressEvent('progress', {
loaded: 0.73, // truncated to 0 — bug!
total: 1, // fine as integer
lengthComputable: true,
});
console.log(e.loaded / e.total); // was: 0/1 = 0 (wrong!)
// Chrome 136: double type preserves fractions
console.log(e.loaded); // 0.73
console.log(e.total); // 1
console.log(e.loaded / e.total * 100); // 73% ✓
// Usage pattern for AI streaming progress:
model.addEventListener('progress', (e) => {
if (e.lengthComputable) {
progressBar.value = e.loaded / e.total; // 0.0 → 1.0
}
});