Results for “int”
Small, practical examples. Search by task or narrow things down below.
Calculate beyond the long integer range
Java: Use BigInteger when a fixed-width primitive type would overflow.
Java✓ Tested
Calculate each group’s integer percentage of the total
SQL: Multiply before division and protect against a zero denominator.
SQL✓ Tested
Calculate each group’s integer percentage of the total
SQL Server: Multiply before division and protect against a zero denominator.
SQL Server✓ Tested
Calculate each group’s integer percentage of the total
Postgres: Multiply before division and protect against a zero denominator.
Postgres✓ Tested
Calculate each group’s integer percentage of the total
SQLite: Multiply before division and protect against a zero denominator.
SQLite✓ Tested
Calculate integers beyond Number’s precise range
JavaScript: Use BigInt operands together to avoid precision loss.
JavaScript✓ Tested
Calculate integers beyond Number’s precise range
TypeScript: Use BigInt operands together to avoid precision loss.
TypeScript✓ Tested
Calculate with integer arithmetic
Bash Scripts: Calculate with integer arithmetic with a small standalone Bash program.
Bash Scripts✓ Tested
Calculate with integer values
Arduino / C: Calculate with integer values on an Uno with the Serial Monitor set to 9600 baud.
Arduino / C✓ Tested
Check an upper integer bound before adding
C++: For these nonnegative values, compare against the maximum minus the addend first.
C++✓ Tested
Check positive integer addition before performing it
C: Check the upper boundary before adding two known nonnegative integers.
C✓ Tested
Check the integrity of a gzip stream
Linux Commands: Use gzip -t to verify a compressed file without extracting it.
Linux Commands✓ Tested