FIND YOUR NEXT FEW LINES

Results for “float”

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

33 snippets foundClear filters
CNumeric parsing & arithmetic

Round a halfway floating-point value

C: The C round function rounds halfway cases away from zero.

C✓ Tested
C++Numeric parsing & calculations

Round halfway floating-point values away from zero

C++: std::round has an explicit halfway rule different from truncation.

C++✓ Tested
CNumeric parsing & arithmetic

Validate a complete floating-point input

C: strtod exposes both the stopping position and range errors; reject nonfinite results when required.

C✓ Tested
Arduino / CSerial protocols

Read a decimal number from serial input

Arduino / C: parseFloat parses a signed decimal value from the input stream.

Arduino / C✓ Tested
SQLiteDates & time

Calculate whole days between dates

Subtract Julian day values for date-only inputs.

julianday✓ Tested
PythonNumbers & calculations

Calculate with exact rational values

Python: Use Fraction for exact ratios rather than binary floating-point approximations.

Python✓ Tested
Arduino / CSensor calculations

Convert Celsius to Fahrenheit

Arduino / C: Use floating-point constants to avoid integer division.

Arduino / C✓ Tested
PythonGetting Started

Divide using a fractional number

Python: Use a floating-point operand to preserve the fractional part of a division.

Python✓ Tested
C#Getting Started

Divide using a fractional number

C#: Use a floating-point operand to preserve the fractional part of a division.

C#✓ Tested
JavaGetting Started

Divide using a fractional number

Java: Use a floating-point operand to preserve the fractional part of a division.

Java✓ Tested
JavaScriptGetting Started

Divide using a fractional number

JavaScript: Use a floating-point operand to preserve the fractional part of a division.

JavaScript✓ Tested
TypeScriptGetting Started

Divide using a fractional number

TypeScript: Use a floating-point operand to preserve the fractional part of a division.

TypeScript✓ Tested