FIND YOUR NEXT FEW LINES

Results for “number”

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

183 snippets foundClear filters
RustNumbers & durations

Reject a narrowing integer conversion

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

Rust✓ Tested
C#Dates & precise numbers

Reject infinity and NaN

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

C#✓ Tested
PythonNumbers & calculations

Reject NaN and infinite numeric inputs

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

Python✓ Tested
HTMLTables & list numbering

Represent a hierarchy with nested lists

HTML: Place the nested list inside its parent list item to preserve the hierarchy.

HTML✓ Tested
HTMLInput constraints

Require numeric values on a chosen step

HTML: The step interval is measured from the minimum value when one is provided.

HTML✓ Tested
C#Dates & precise numbers

Round a decimal using an explicit midpoint rule

C#: Use decimal literals for decimal arithmetic and choose the midpoint rounding behavior.

C#✓ Tested
RustNumbers & durations

Round and format a decimal value

Round and format a decimal value in a complete Rust program using the standard library.

Rust✓ Tested
PythonNumbers & calculations

Round decimal amounts explicitly

Python: Build Decimal values from strings and choose a rounding rule explicitly.

Python✓ Tested
RustNumbers & durations

Saturate arithmetic at the type boundary

Saturate arithmetic at the type boundary in a complete Rust program using the standard library.

Rust✓ Tested
PythonNumbers & calculations

Select the largest values without sorting everything

Python: Use heapq.nlargest when only a small prefix of the ranking is required.

Python✓ Tested
HTMLTables & list numbering

Separate table headings data and totals

HTML: Thead, tbody, and tfoot group rows according to their purpose.

HTML✓ Tested
HTMLTables & list numbering

Set consistent widths for table columns

HTML: A colgroup applies presentation to whole columns without repeating styles on every cell.

HTML✓ Tested