Skip to content

parity(stress): the LF/HF ratio prints through the same tenths arithmetic on both platforms - #2369

Merged
ryanbr merged 1 commit into
ryanbr:mainfrom
ayiskakov:parity/stress-ratio-tenths
Sep 23, 2026
Merged

ryanbr merged 1 commit into
ryanbr:mainfrom
ayiskakov:parity/stress-ratio-tenths

Conversation

@ayiskakov

Copy link
Copy Markdown

What

Went to implement #2167 and found the filed gap already closed on main — every level surface
routes through the shared formatLevel and the Swift suite pins the three exact quarters. But the
LF/HF ratio tile one line below the level tiles still prints through the two platforms' printf
families, and those round exact halves in opposite directions: Java's %.1f rounds half up,
C's rounds half to even. So an exact quotient such as 9/4 spells "2.3" on Android and "2.2" on iOS
— and unlike the logistic-squashed level, a quotient genuinely can land on an exact binary
fraction.

Change

  • StressTrace.formatRatio on both platforms: the level's tenths arithmetic and floor brace,
    without the stress-domain ceiling — a sympathetic-leaning ratio above 3 must print as itself,
    not as "3.0".
  • Both ratio tiles (StressView.swift, StressScreen.kt) route through it; that removes the last
    printf-family formatter from the stress surfaces.
  • Pins on both sides, including the exact-quarter formatLevel trio the Kotlin suite was missing —
    the Swift suite already pinned it, and each side's pin guards its own direction.

Verification

  • Swift: StrandTests/StressTraceTests run green locally under
    xcodebuild … -only-testing:StrandTests/StressTraceTests test on the macOS destination (the
    macOS app module compiles StressTrace.swift per project.yml, so this covers the shared
    surface).
  • Kotlin: no local Android toolchain here — android.yml compiles and runs StressTraceTest on
    this PR; the same commit is already green on my fork's CI.
  • Display-format only: no stored value or score changes.

Refs #2167.

…etic on both platforms

The level adopted shared arithmetic (ryanbr#2165), but the ratio tile one line below
still went through each platform's printf family — which round exact halves in
OPPOSITE directions (Java %.1f half-up, C %.1f half-even), so an exact quotient
such as 9/4 spelled "2.3" on Android and "2.2" on iOS. Unlike the
logistic-squashed level, a quotient can land on exact binary fractions.

StressTrace gains formatRatio (the level's tenths arithmetic, floor brace, no
domain ceiling) on both platforms, both ratio tiles route through it, and the
pins land on both sides — including the exact-quarter formatLevel trio the
Kotlin suite was missing, since each side's pin guards its own direction.

Refs ryanbr#2167
@ryanbr
ryanbr force-pushed the parity/stress-ratio-tenths branch from daf0df0 to de4b240 Compare September 23, 2026 04:59
@ryanbr
ryanbr merged commit 15c34d4 into ryanbr:main Sep 23, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants