Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- For use with big integers. Ex. -2419354838 / -1303434343
- ```javascript
- const remainder = (dividend, divisor) => {
- return divisor == 0 ? "NaN" : dividend - (Math.floor(dividend / divisor) * divisor);
- };
- remainder(-2419354838, -1303434343) // -1115920495
- ```
- For use big small integers. Ex. 1000 / 400
- ```javascript
- const remainder = (dividend, divisor) => {
- return divisor === 0 ? "NaN" : dividend - divisor * ~~(dividend / divisor);
- };
- remainder(1000,400) // 400
- ```
Add Comment
Please, Sign In to add comment