Repository navigation
console.log: null strings and format placeholders; Math.round and parseFloat as JavaScript's - #130
Merged
Merged
Conversation
…seFloat as JavaScript's Found by comparing programs' output with Node's: - console.log of a null string printed through it (a crash without strict null checks): it is "null" - console.log fills %s %d %i %f %j %o %O %c from the arguments after the first, and %% is "%" - Math.round rounds a half up (Math.round(-2.5) is -2; C's round gave -3), -0 between -0.5 and 0 - parseFloat is NaN where the text has no number (strtod gave 0), reads no hexadecimal, and "Infinity" only spelled so Needs the compiler of the same change (console.log arguments made strings in Node's inspect form). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… own test is 00number_conversion_forms)
Number("abc") is NaN only with the compiler of TypeScriptCompiler#1080, and this repository's CI tests with the
newest compiler release.
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.
Found by comparing programs' output with Node's (compiler side: ASDAlexander77/TypeScriptCompiler#1080).
console.logof a null string read through it, a crash without strict null checks: it printsnullconsole.logfills%s %d %i %f %j %o %O %cfrom the arguments after the first, and%%is%(they were printed as they are)Math.roundrounds a half up, as JavaScript does:Math.round(-2.5)is -2 (C'sroundgave -3), and -0 between -0.5 and 0parseFloatis NaN where the text has no number (strtodgave 0), reads no hexadecimal, and readsInfinityonly when spelled soNew test
tests/node_output_forms.ts.Testing
tests/node_output_forms.tsandtests/string_concat.tsunder gc, rc, none and own with the compiler of #1080tests.ps1run is in progress locally🤖 Generated with Claude Code