Repository navigation
fix(float): a float's text is read by strtod, not by Float from - #237
Merged
Merged
Conversation
x-lang #1322 made `Float from` read a string as x source: 1e3, 1., .5,
inf and nan are no longer floats there, and every Python float literal
and float() of them failed on x-lang main with "Float from: not
convertible to FLOAT". Each caller has already checked the text against
Python's grammar, so it wants the C library's reading: python-strtod
(python/types.x) takes x/num/float's str->float, exported on v0.55.0 and
on main alike, through a selective import inside a call as %py-libm-fn
does. Float literals, imaginary literals, float('...') and round()'s
rebuilt results go through it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
python/types.x loads before python/core.x imports the tower, so its import of x/num/float loaded float on the bare dialect, and the source boot (`x -l python`, tests/boot.sh) ran out of memory at 12 GB. The suite's harness has the whole tower loaded first and never saw it. runtime-num.x loads after the tower and ahead of every caller. 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.
On x-lang main, every
specs @ x-lang mainjob fails withFloat from: not convertible to FLOAT. That includes x-python main itself, rerun today. The cause is x-lang #1322 (eac54454, in the untagged 0.56.0):Float fromnow reads a string as x source.1e3,1.,.5,infandnanare no longer floats to it.x-python's callers have already checked the text against Python's own grammar before converting: the tokenizer for literals, and
%py-float-str-ok?forfloat('...'). So the C library's reading is the right one.python-strtod(python/types.x) wrapsx/num/float's exportedstr->float, which isstrtodon v0.55.0 and on main alike. It is taken by a selective import inside a call, the way%py-libm-fntakeslibm-fn.float('...')(including inf/nan) andround()'s rebuilt results go through it. NoFloat fromon a string is left.Verified, full suite:
This unblocks the x-lang main jobs on #236 too.
🤖 Generated with Claude Code