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
JavaPrecise numeric calculations

Compare floating-point results with a tolerance

Java: For this bounded example, compare the absolute difference against a chosen error threshold.

Java✓ Tested
Arduino / CSensor calculations

Convert a supplied ADC count to volts

Arduino / C: Scale a ten-bit ADC count using an explicit reference voltage.

Arduino / C✓ Tested
Arduino / CSensor calculations

Convert Celsius to Fahrenheit

Arduino / C: Use floating-point constants to avoid integer division.

Arduino / C✓ Tested
JavaPrecise numeric calculations

Detect integer addition overflow

Java: Math.addExact throws rather than silently wrapping on overflow.

Java✓ Tested
JavaPrecise numeric calculations

Display an integer as unsigned

Java: Use unsigned conversion methods when interpreting a fixed-width bit pattern.

Java✓ Tested
JavaPrecise numeric calculations

Divide decimal values with controlled precision

Java: Choose both scale and rounding for a quotient that does not terminate in base ten.

Java✓ Tested
JavaPrecise numeric calculations

Divide negative integers with floor rounding

Java: floorDiv and floorMod provide consistent floor-based quotient and remainder.

Java✓ Tested
PythonNumbers & calculations

Find common factors and multiples

Python: Use the integer gcd and lcm helpers to avoid floating-point calculations.

Python✓ Tested
JavaPrecise numeric calculations

Find the greatest common divisor

Java: BigInteger.gcd calculates an exact nonnegative common divisor.

Java✓ Tested
C++Numeric parsing & calculations

Find the greatest common divisor with the standard library

C++: std::gcd computes a nonnegative integer common divisor.

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

Find the least common multiple with the standard library

C++: std::lcm combines positive integer periods into a common cycle.

C++✓ Tested
PythonNumbers & calculations

Find the mean and median of readings

Python: Use statistics helpers to distinguish an arithmetic mean from a middle value.

Python✓ Tested