-
Notifications
You must be signed in to change notification settings - Fork 287
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 flags to control trailing decimal and zero in exponent form when input has one significant digit #195
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
CLA is now signed. |
Thanks for the PR.
|
Happy to make this a separate flag. Any suggestions for what to name it? 😅 |
I would keep it simple:
wdyt? |
EMIT_TRAILING_DECIMAL_POINT
, EMIT_TRAILING_ZERO_AFTER_POINT
@floitsch PTAL |
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.
LGTM!
Thanks.
…, remove patches (#36002) [double-conversion v3.3.0](https://github.com/google/double-conversion/releases/tag/v3.3.0) adds a [new feature](google/double-conversion#195) that allows us to remove the special code that was added to our vendored copy of double-conversion in #9816. This PR: * Updates vendored double-conversion to v3.3.0 * Activates the new flags `EMIT_TRAILING_DECIMAL_POINT_IN_EXPONENTIAL` and `EMIT_TRAILING_ZERO_AFTER_POINT_IN_EXPONENTIAL` * Removes the patches in `cpp/src/arrow/vendored/double-conversion/patches` ----- * Closes: #35669 Authored-by: Ian Cook <[email protected]> Signed-off-by: Sutou Kouhei <[email protected]>
This implements an improvement in how theThis adds new flagsEMIT_TRAILING_DECIMAL_POINT
andEMIT_TRAILING_ZERO_AFTER_POINT
flags affectEMIT_TRAILING_DECIMAL_POINT_IN_EXPONENTIAL
andEMIT_TRAILING_ZERO_AFTER_POINT_IN_EXPONENTIAL
to control the trailing decimal and zero in conversion to scientific notation when the input number has exactly one significant digit.These flags control the behavior of
ToShortest()
andToPrecision(, 1)
which currently do not respect the existing flagsEMIT_TRAILING_DECIMAL_POINT
andEMIT_TRAILING_ZERO_AFTER_POINT
in this situation.ToExponential()
OTOH does respect the existing flags in this situation, and its behavior is unaffected by these new flags.For example: when both of the new flags are activated,
ToShortest(0.00001)
andToPrecision(0.00001, 1)
both currently emit1E-5
, but after this PR they both emit1.0E-5
.This change was originally made in Apache Arrow's vendored copy of double-conversion in apache/arrow#9816. The Apache Arrow developers would like to contribute this improvement upstream so that we can depend directly on upstream double-conversion. Thank you.