Skip to content

Main content

Day Fraction Midnight Wrap Tool

Wrap explicitly supplied elapsed-day fractions at integer midnight boundaries, without time zones or leap seconds.

Loading tool…

Description

Add day fractions and separate a signed whole-day carry.

Timestamp notation distinguishes written precision, quantization and carry into the next larger field. Padding a fraction, rounding it and propagating an end-of-day marker are different operations and do not establish clock accuracy.

Add day fractions and separate a signed whole-day carry.

When to use this tool

Use Day Fraction Midnight Wrap when checking one explicit timestamp precision, rounding or carry convention.

How to use the tool and how it works

  1. Enter dayFraction, addedFraction. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read dayCarry, withinDayFraction. Use the output convention below.

Add day fractions and separate a signed whole-day carry. Require their sum finite; dayCarry = floor(total) and withinDayFraction = total-dayCarry.1

Input fieldMeaning and unitsAccepted input
dayFractionDay FractionRequired. Finite number.
addedFractionAdded FractionRequired. Finite number.
Output fieldInterpretationReturned shape
dayCarryfloor(dayFraction+addedFraction); can be negative.Required. Safe integer.
withinDayFractionNonnegative modulo-one remainder, in [0,1).Required. Finite number.
json
{
  "input": {
    "dayFraction": 0.75,
    "addedFraction": 0.5
  },
  "output": {
    "dayCarry": 1,
    "withinDayFraction": 0.25
  }
}

Limitations and assumptions

  • Negative totals still return a within-day fraction in [0,1); physical day length is not inferred.
  • Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
  • Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.

Alternative or Complementary methods

Use complete date-time arithmetic when a carry must change a date or interact with timezone transitions.

References

  1. Calculation and input contract: date/day-fraction-midnight-wrap — tool.io

Similar or alternative tools