-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stdlib, stdio: improve float string parsing #370
Merged
Merged
Conversation
This file contains 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
jmaksymowicz
force-pushed
the
jmaksymowicz/float-parsing
branch
from
August 2, 2024 09:17
13adb84
to
216557c
Compare
jmaksymowicz
force-pushed
the
jmaksymowicz/float-parsing
branch
from
August 2, 2024 10:20
216557c
to
5a267af
Compare
jmaksymowicz
changed the title
WIP stdlib, stdio: improve float string parsing
stdlib, stdio: improve float string parsing
Aug 2, 2024
Darchiv
reviewed
Aug 19, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a few comments.
Tests related to the fixed issues are disabled (https://github.com/phoenix-rtos/phoenix-rtos-tests/blob/master/libc/stdlib/stdlib_strto.c#L68 - all #ifdef
s for 703 and 704 issues) and can be enabled now.
jmaksymowicz
force-pushed
the
jmaksymowicz/float-parsing
branch
from
August 20, 2024 10:20
5a267af
to
4f99eaa
Compare
14 tasks
Darchiv
reviewed
Nov 6, 2024
jmaksymowicz
force-pushed
the
jmaksymowicz/float-parsing
branch
from
November 6, 2024 16:36
4f99eaa
to
7e510ae
Compare
Darchiv
previously approved these changes
Nov 7, 2024
Add parsing of infinity and NaN strings. Add parsing of hexadecimal floating point numbers. Improve performance and reduce code size. JIRA: RTOS-868
Parse input string directly instead of copying it to a buffer unless necessary. Perform conversion once instead of twice. JIRA: RTOS-868
Over-read was possible if width was greater than remaining input length when using %c format. JIRA: RTOS-868
jmaksymowicz
force-pushed
the
jmaksymowicz/float-parsing
branch
from
November 7, 2024 12:49
7e510ae
to
7b6fa8f
Compare
Darchiv
approved these changes
Nov 7, 2024
This was referenced Nov 13, 2024
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.
Description
strtof
,strtod
andstrtold
can parse infinity and NaN string representations, as well as hexadecimal floating point representationsstrtof
andstrtod
was improved. Nowuint64_t
is used as an intermediate container for digits that were read, instead oflong double
used previously. This reduces the number oflong double
multiplications necessary.scanf
was reworked, fixing some bugs and improving performance (e.g. previously the conversion was performed twice, with one result being discarded).scanf
for%c
format.Motivation and Context
Fix phoenix-rtos/phoenix-rtos-project#634, phoenix-rtos/phoenix-rtos-project#657, phoenix-rtos/phoenix-rtos-project#703, phoenix-rtos/phoenix-rtos-project#704, phoenix-rtos/phoenix-rtos-project#652, phoenix-rtos/phoenix-rtos-project#1116
Partially fix phoenix-rtos/phoenix-rtos-project#681 (supports width specifier for "%f" up to 31)
Types of changes
How Has This Been Tested?
Checklist:
Special treatment