-
Notifications
You must be signed in to change notification settings - Fork 41
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 simplified implementation in subproject/simple
#67
Conversation
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.
Overall, looks pretty good. Thanks a lot!
There are just a few things that does not align with my preferences.
Thanks for the prompt and detailed review. All your requested changes sound fine to me. I will implement them tomorrow (Monday) night. |
I think I addressed each of your comments with one commit, in order. |
Fix a typo, some clarification, etc.
Merged, thanks! |
Just a few notes about commits I made after merging the PR (not the ones listed above):
Thanks again! |
Regarding #64; here's my first stab at simplifying your reference implementation. It's still not exactly short and sweet, but it's at least a bit less noisy with macros and templates.
This implementation supports both
to_decimal
andto_chars
, and thebinary_to_decimal_rounding
,decimal_to_binary_rounding
, andcache
policies. It's all in one file,simple_dragonbox.h
.It also has its own test executable,
simple_dragonbox_test.cpp
, which implements the same tests asuniform_random_test
andtest_all_shorter_interval_cases
from the primary implementation.I arrived at this implementation mostly by refactoring your existing code, rather than writing a new implementation from scratch, so there may still be simplifications I didn't spot. Especially your main algorithm, which I essentially didn't touch at all.
I'm submitting this as what I've got so far, since I need to pause working on it for now. From your comment on issue #64, I think there are a few further changes you might prefer to make:
I might return to work on those in the future. Let me know if there's anything else you see here that I missed as a simplification you had in mind. I wasn't sure how much you wanted to remove special cases for e.g. division by powers of 10, etc.