You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[P2] Recovery trace rounds negative half-ties differently on Swift and Kotlin #38
The byte-aligned Recovery diagnostic trace uses different rounding rules for negative half-ties. A skin-temperature term of exactly -0.125 is rendered as -0.13 by Swift and -0.12 by Kotlin.
The Charge score itself is unchanged; this is a P2 parity bug in diagnostic output.
Minimal reproduction
Call recoveryTrace with a usable HRV baseline and:
skinTempDev = 0.125
The skin-temperature scale is 1.0, so the traced term is exactly -0.125.
Observed behavior
Platform
Rendered value
Swift
-0.13
Kotlin
-0.12
Cause
Swift's default Double.rounded() handles this negative half-tie away from zero. Kotlin's Math.round handles it toward positive infinity.
Impact
Recovery traces are intended to be byte-aligned and fixture-testable across platforms. This creates false drift reports, although the Charge score itself is unchanged.
Acceptance criteria
Choose and document one common trace-rounding rule.
Emit identical strings for positive and negative half-ties, including ±0.125.
Preserve non-tie trace values and the returned Charge score.
Add an exact differential fixture for the complete trace.
This is fully reproducible with unit tests; no hardware testing is required.
Activity
bhelm commentedon Aug 19, 2026
Resolved and differentially verified.
z=-0.13) while the Recovery score remains unchanged.The separate signed-zero and huge-finite formatting boundary remains tracked in #47.