Skip to content
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

sscanf doesn't know about floating-point numbers? #456

Closed
parasti opened this issue Jun 28, 2022 · 1 comment
Closed

sscanf doesn't know about floating-point numbers? #456

parasti opened this issue Jun 28, 2022 · 1 comment

Comments

@parasti
Copy link

parasti commented Jun 28, 2022

Basic test case:

int main()
{
    float f = 0;
    sscanf("0.3715", "%f", &f);
    printf("%f\n", f);
    return 0;
}

Results in

$ ./hello.com.dbg
0.000000
@matheusmoreira
Copy link
Contributor

I'm working on it. So far I've managed to make it pass your test case:

$ ./o/examples/parsefloat.com
0.371500

Need to test it more and polish it up for a pull request.

matheusmoreira added a commit to matheusmoreira/cosmopolitan that referenced this issue Nov 2, 2023
Essentially an expanded version of the basic test case
posted in GitHub issue jart#456. Also includes examples from documentation.

References:

jart#456
https://en.cppreference.com/w/c/string/byte/strtof
@parasti parasti closed this as completed Nov 19, 2023
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

No branches or pull requests

2 participants