Skip to content

[P3] effectiveEffort preserves signed zero differently across platforms #37

Closed

Description

@bhelm

Summary

Swift and Kotlin return different IEEE-754 zero signs for one effectiveEffort input ordering.

This was found by the Strain differential rollout tracked in #17.

Minimal reproduction

live = +0.0
stored = -0.0

Observed behavior

Platform Result IEEE-754 bits
Swift -0.0 8000000000000000
Kotlin +0.0 0000000000000000

With the operands reversed, both implementations return +0.0.

Likely cause

The platforms use different maximum semantics for equal signed-zero operands: Swift preserves the second operand in this case, while kotlin.math.max canonicalizes the result to positive zero.

Impact

The numeric and displayed value remains zero. The difference matters only for exact serialization, hashing, or bit-level parity.

Severity: P3.

Acceptance criteria

  • Decide whether effectiveEffort promises numeric equality or exact IEEE-754 parity.
  • If exact parity is required, normalize signed zero identically on both platforms.
  • Add mirrored deterministic tests for both operand orders.

No hardware testing is required; this is pure analytics behavior.

Activity

  1. bhelm commented on Sep 7, 2026

    @bhelm
    OwnerAuthor

    Fixed upstream by ryanbr#1792 (merged), which canonicalizes signed zero in effective effort
    so a live and stored value of 0.0 returns +0.0 identically on both platforms. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions