JSFiddle - React, Tailwind, and code Playground
HTML
<p>We're going to test numbers from the high resolution timer and see how many of them are equivalent to their integer representation.
<textarea id=output></textarea>
CSS
textarea { height: 300px; width: 500px; }
JavaScript
if (!(window.performance && performance.webkitNow)) alert('chrome canary required');
var start = performance.webkitNow();
var integers = [];
var floatingPoints = [];
var now;
// run (hang your browser) for 5 seconds
while (( now = performance.webkitNow()) < (start + 5 * 1000)){
// if any are equivalent to their integer form
if (now.toString().indexOf('.') > -1) floatingPoints.push(now);
else integers.push(now);
}
document.querySelector('#output').innerText = '' +
['Numbers tested: ' + (integers.length + floatingPoints.length),
'Numbers with decimal values: ' + floatingPoints.length,
'Numbers with integer values: ' + integers.length]
.join('\n');
console.log('integers', integers);