Repository navigation
Spec 033 T004: floats as JDK 11's Float.toString writes them - #1124
Merged
Merged
Conversation
miscore writes each score with Float.toString and reads it back as a double, so the score Java filters and rounds is that text's double. JDK 11 writes a float through the same FloatingDecimal steps as a double (its fraction moved up to bit 52, a precision of 24), so java-double.ts's digit generation is now shared, not copied. Compared with JDK 11 itself, the JDK the deployed service runs on, over 12,507,903 floats: none differ, and 1,330,237 of them are not in the shortest form, which JavaScript's own text would have written. The fixture keeps 4,009, with every decimal score between 0 and 1. The spec fails with a double's precision (8 tests) and with JavaScript's shortest form (11 tests). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Spec 033 T004.
Why it's needed: miscore writes each MI-score with
Float.toStringand reads it back withDouble.parseDouble(research-psicquic.md §6). So the score Java filters at 0.45 and rounds is the double of that text, not the float itself.What it adds:
tools/content-node/java-float.ts:jdk11FloatText(value)gives the text JDK 11'sFloat.toStringwrites for the float nearestvalue;throughFloatText(value)gives miscore's round trip.java-double.tsshares its digit generation (floatingDecimalDigits,layOut). JDK 11 writes a float through the sameFloatingDecimalsteps as a double: the float's 23-bit fraction is moved up to bit 52 and developed with a precision of 24. So the logic is shared, not copied.java-double.spec.tsstill passes unchanged.Measured against JDK 11 itself. The deployed service runs on JDK 11, so that's the JDK that matters. JDK 19 and later write the shortest form, so they're no reference here.
--release 11and run on JDK 11.0.33, streamed 12,507,903 floats into a node checker. They were every 997th bit pattern, 8 million random ones, and k / 100,000 for k from 0 to 100,000. None differ.fixtures/java-float.txt) keeps 4,009 of them: the specials and boundaries, every decimal score from 0 to 1 at three places, and 1,500 non-shortest and 1,500 shortest others.Seen failing:
Both mutants were restored from a copy.
One part of the task not done here: it asked for single-precision steps. JavaScript's
Math.froundalready gives them exactly, so no wrapper is added; the score port (T009) uses it directly. tasks.md says so.🤖 Generated with Claude Code