-
Notifications
You must be signed in to change notification settings - Fork 71
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
Fix a bug in format_float kernel #1676
Conversation
Signed-off-by: Haoyang Li <[email protected]>
build |
bool const sign, | ||
char* const result, | ||
int digits) | ||
__device__ inline int to_formated_double_chars(floating_decimal_64 const v, |
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.
Nit: Minor typo.
__device__ inline int to_formated_double_chars(floating_decimal_64 const v, | |
__device__ inline int to_formatted_double_chars(floating_decimal_64 const v, |
bool const sign, | ||
char* const result, | ||
int digits) | ||
__device__ inline int to_formated_float_chars(floating_decimal_32 const v, |
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.
Nit:
__device__ inline int to_formated_float_chars(floating_decimal_32 const v, | |
__device__ inline int to_formatted_float_chars(floating_decimal_32 const v, |
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.
I'm ok with this change, but we're going to have to address some minor stuff in this source file, at some point.
- It would be good to add some function-level docs to
to_formatted_float_chars
,to_formatted_double_chars
. - Is there commonality between
to_formatted_float_chars
andto_formatted_double_chars
? If we discount the difference of callingdecimalLength17
anddecimalLength9
, they look like this could be a single function template. (I haven't looked closely enough, maybe?) - Is
actural_round
supposed to beactual_round
?
We can address this later, in a follow-on.
Thanks for the review @mythrocks ! will address those later. |
format_number(0.485362439659, 13)
will get 1.8536243965900 in the plugin. It's a kernel bug.Current
round_half_even
will handle trailing zeros, but it's unnecessary because it will be handled later anyway, and it will confuse the following logic which checks the length of the rounded number.Also add some minor refactoring and testing.