Skip to content

Commit

Permalink
Update src/main/cpp/src/cast_float_to_string.cu
Browse files Browse the repository at this point in the history
Co-authored-by: Mike Wilson <[email protected]>
  • Loading branch information
thirtiseven and hyperbolic2346 authored Oct 19, 2023
1 parent 8d7ead2 commit 9ab2089
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/main/cpp/src/cast_float_to_string.cu
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,14 @@ struct ftos_converter {
memcpy(output, "NaN", 3);
return 3;
}
bool bneg = false;
if (signbit(value)) { // handles -0.0 too
value = -value;
bneg = true;
}
bool const bneg = [&value]() {
if (signbit(value)) { // handles -0.0 too
value = -value;
return true;
} else {
return false;
}
}();
if (std::isinf(value)) {
if (bneg) {
memcpy(output, "-Infinity", 9);
Expand Down

0 comments on commit 9ab2089

Please sign in to comment.