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

Add optimized (smaller) lookup table for float type parsing #103

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jrahlf
Copy link
Contributor

@jrahlf jrahlf commented Sep 12, 2021

Reduce code size if only float accuracy is needed for parsing, implements #99

Pro:

Con:

  • minimal binary code size increase if both double and float types are used for parsing
  • increases code bloat

The correct LUT is selected in compute_product_approximation, depending on the bit_precision.
Currently it selects the float LUT, if the bit_precision is smaller than 27. I actually do not like this switch, do you have a better proposal?

Adds:

  • script/table_generation_float.py
  • tests/example_test_float.cpp
  • tests/example_test_mixed.cpp

@lemire
Copy link
Member

lemire commented Sep 12, 2021

Since one goal is to eventually move this library toward supporting from_chars fully, I am not sure I like the idea of sacrificing the general case for what I see as a rather specific use case (you want to use from_chars but you also only care about binary32).

Certainly, anything that increases the binary bloat of the general case does not move us in the right direction, I think. The idea of better supporting the isolated use case (from_chars but only with binary32) is nice, but I think it should come with no compromise over the general case.

Cheers!

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

Successfully merging this pull request may close these issues.

2 participants