Results for “finite”
Small, practical examples. Search by task or narrow things down below.
Check whether a floating-point value is finite
Check whether a floating-point value is finite in a complete Rust program using the standard library.
Rust✓ Tested
Reject infinite and NaN numeric values
C++: std::isfinite excludes special floating-point values.
C++✓ Tested
Reject NaN and infinite numeric inputs
Python: Use isfinite before computations that require an ordinary finite float.
Python✓ Tested
Reject NaN and infinite values
PowerShell: Double.IsFinite excludes numeric values unsuitable for ordinary bounded calculations.
PowerShell✓ Tested
Reject NaN and infinite values
C: isfinite detects whether a floating-point value is an ordinary finite number.
C✓ Tested
Reject non-finite numeric input
Reject non-finite numeric input using a complete Go program with explicit sample inputs.
Go✓ Tested
Reject nonfinite floating-point values
Java: Double.isFinite excludes both infinity and NaN.
Java✓ Tested
Represent a finite set of states
Java: Use an enum to prevent arbitrary strings from representing application states.
Java✓ Tested
Validate a finite numeric value without coercion
JavaScript: Number.isFinite rejects numeric strings as well as NaN and infinity.
JavaScript✓ Tested
Validate a finite numeric value without coercion
TypeScript: Number.isFinite rejects numeric strings as well as NaN and infinity.
TypeScript✓ Tested
Reject infinity and NaN
C#: Double.IsFinite distinguishes usable finite numeric inputs from special values.
C#✓ Tested
Repeat a string a fixed number of times
JavaScript: String.repeat requires a nonnegative finite repetition count.
JavaScript✓ Tested