FIND YOUR NEXT FEW LINES

Results for “Numbers & calculations”

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

151 snippets foundClear filters
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
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#Dates & precise numbers

Parse a date without a time component

C#: DateOnly avoids attaching an irrelevant time or timezone to a calendar date.

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
RustNumbers & durations

Reject a narrowing integer conversion

Reject a narrowing integer conversion in a complete Rust program using the standard library.

Rust✓ Tested
C++Numeric parsing & calculations

Reject infinite and NaN numeric values

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

C++✓ Tested
C#Dates & precise numbers

Reject infinity and NaN

C#: Double.IsFinite distinguishes usable finite numeric inputs from special values.

C#✓ Tested
JavaPrecise numeric calculations

Reject nonfinite floating-point values

Java: Double.isFinite excludes both infinity and NaN.

Java✓ Tested