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
C++Numeric parsing & calculations

Format an integer into a caller-owned buffer

C++: to_chars avoids allocation and reports whether the buffer was large enough.

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

Handle a failed string-to-integer conversion

C++: stoi throws invalid_argument when no conversion can be performed.

C++✓ Tested
Arduino / CSensor calculations

Ignore small movements around a center value

Arduino / C: Values inside the deadband become zero while others keep their direction.

Arduino / C✓ Tested
PythonNumbers & calculations

Insert a value while preserving sorted order

Python: Use insort on an already sorted list; insertion still shifts later list elements.

Python✓ Tested
Arduino / CSensor calculations

Interpolate between two calibration points

Arduino / C: Compute a fractional position before scaling to the output interval.

Arduino / C✓ Tested
Arduino / CSensor calculations

Maintain a rolling sum in a circular window

Arduino / C: Subtract the overwritten sample before adding the next one.

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

Parse a complete integer without exceptions

C++: from_chars reports both an error code and the first unconsumed character.

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

Parse a hexadecimal integer with from_chars

C++: An explicit radix controls digit interpretation without a locale dependency.

C++✓ Tested
JavaPrecise numeric calculations

Parse an integer in another base

Java: Supply an explicit radix to Integer.parseInt.

Java✓ Tested
Arduino / CSensor calculations

Prevent output chatter with separate thresholds

Arduino / C: Use different on and off thresholds to retain state between them.

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

Reject infinite and NaN numeric values

C++: std::isfinite excludes special floating-point values.

C++✓ Tested
PythonNumbers & calculations

Reject NaN and infinite numeric inputs

Python: Use isfinite before computations that require an ordinary finite float.

Python✓ Tested