FIND YOUR NEXT FEW LINES

Results for “Reporting & grouped calculations”

Small, practical examples. Search by task or narrow things down below.

91 snippets foundClear filters
SQLReporting & grouped calculations

Turn known group values into columns

SQL: Conditional aggregation gives a portable pivot when the category set is known.

SQL✓ Tested
SQL ServerReporting & grouped calculations

Turn known group values into columns

SQL Server: Conditional aggregation gives a portable pivot when the category set is known.

SQL Server✓ Tested
PostgresReporting & grouped calculations

Turn known group values into columns

Postgres: Conditional aggregation gives a portable pivot when the category set is known.

Postgres✓ Tested
SQLiteReporting & grouped calculations

Turn known group values into columns

SQLite: Conditional aggregation gives a portable pivot when the category set is known.

SQLite✓ Tested
PythonNumbers & calculations

Compare floating-point calculations with tolerance

Python: Use isclose instead of exact equality for results affected by floating-point rounding.

Python✓ Tested
Arduino / CSensor calculations

Apply a linear sensor calibration

Arduino / C: Convert a raw reading using an offset and scale measured for the sensor.

Arduino / C✓ Tested
C++Numeric parsing & calculations

Calculate a two-dimensional vector length

C++: hypot avoids unnecessary intermediate overflow in the sum of squares.

C++✓ Tested
JavaPrecise numeric calculations

Calculate beyond the long integer range

Java: Use BigInteger when a fixed-width primitive type would overflow.

Java✓ Tested
PythonNumbers & calculations

Calculate the number of required pages

Python: Use integer arithmetic to round a nonnegative count up to a positive page size.

Python✓ Tested
PythonNumbers & calculations

Calculate with exact rational values

Python: Use Fraction for exact ratios rather than binary floating-point approximations.

Python✓ Tested
C++Numeric parsing & calculations

Check an upper integer bound before adding

C++: For these nonnegative values, compare against the maximum minus the addend first.

C++✓ Tested
PythonNumbers & calculations

Clamp a numeric value between bounds

Python: Combine min and max for a closed interval when lower is no greater than upper.

Python✓ Tested