v2
8/16/2019 by fuchsia -00
Setup HTML - click to add setup HTML
disable setup JavaScript
Setup JavaScript
let numbers = [];
for (let i = 0; i < 10000; ++i)
{
  numbers.push( [(Math.random()-0.5)*Number.MAX_SAFE_INTEGER, (Math.random()-0.5)*Number.MAX_SAFE_INTEGER] )
}
delete caserun single casemove downdrag and drop case


ready



numbers.map( ([ x, y ]) => ( ( x % y ) + y ) % y );
delete caserun single casemove upmove downdrag and drop case


ready



numbers.map( ([x,y]) => x - Math.floor( x / y ) * y);
delete caserun single casemove upmove downdrag and drop case


ready



  numbers.map( ([x,y]) => {
    const z = x % y; 
    return ( y >= 0 ? (z >= 0 ) : ( z <= 0 ) ) ? z : y + z;
  })
delete caserun single casemove updrag and drop case


ready



numbers.map( ([x,y]) => {
  const z = x % y; 
  return ( (y >= 0 && z >= 0 ) || ( y < 0 && z <= 0 ) ) ? z : y + z;
})
Test Case - click to add another test case
Teardown JS - click to add teardown JavaScript
Output (DOM) - click to monitor output (DOM) while test is running
RUN