Results for “Errors & optional values”
Small, practical examples. Search by task or narrow things down below.
Compare bounded floating-point results with a tolerance
JavaScript: Use an absolute error threshold for values known to be near one.
JavaScript✓ Tested
Compare bounded floating-point results with a tolerance
TypeScript: Use an absolute error threshold for values known to be near one.
TypeScript✓ Tested
Constrain a calendar date input
HTML: Use ISO date values for the date control’s minimum and maximum.
HTML✓ Tested
Convert Unix time to a timestamp
Interpret a seconds-since-epoch value as UTC.
unixepoch✓ Tested
Copy a file in bounded binary chunks
C: Check read, write, and close errors while copying without loading the entire file.
C✓ Tested
Copy an array independently
Bash Scripts: A new array assignment copies element values rather than creating a shared reference.
Bash Scripts✓ Tested
Copy nested structured data independently
JavaScript: structuredClone creates an independent copy of supported structured values.
JavaScript✓ Tested
Copy nested structured data independently
TypeScript: structuredClone creates an independent copy of supported structured values.
TypeScript✓ Tested
Count day boundaries between dates
Compare date values with DATEDIFF.
DATEDIFF✓ Tested
Count days between calendar dates
PowerShell: Parse an unambiguous format before subtracting date values.
PowerShell✓ Tested
Count items by group
Group repeated values and report each count.
Group-Object✓ Tested
Count occurrences in a sorted sequence
C++: equal_range finds the half-open interval containing values equal to the key.
C++✓ Tested