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

Float exponent support: "%e" / "%E" #17

Open
charlesnicholson opened this issue Jul 5, 2019 · 2 comments
Open

Float exponent support: "%e" / "%E" #17

charlesnicholson opened this issue Jul 5, 2019 · 2 comments
Labels
enhancement New feature or request

Comments

@charlesnicholson
Copy link
Owner

No description provided.

@charlesnicholson charlesnicholson changed the title Float exponent support: %e / %E Float exponent support: "%e" / "%E" Jul 5, 2019
@charlesnicholson charlesnicholson added the enhancement New feature or request label Jul 5, 2019
@charlesnicholson
Copy link
Owner Author

Maybe something cheapo like this would work:

Determine a multiplier of 10.0f or 0.1f based on initial condition of 0 <= abs(x) <= 1 or abs(x) > 1. Determine log10(x) by counting how many applications of the multiplier brings x into 1 <= abs(x) < 10. Once x is exponent-normalized just print it like a normal reversed float, but stick the e+02 (or whatever) reversed at the beginning of cbuf.

This means that the concept of precision will have to be pushed into this new etoa_rev function maybe?

@charlesnicholson
Copy link
Owner Author

Also make sure that there aren't any floating point numbers where successive multiplications of 0.1 or 10.0 won't eventually normalize it to 1 <= abs(x) < 10. Floats are hard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant