diff --git a/src/main/cpp/src/cast_float_to_string.cu b/src/main/cpp/src/cast_float_to_string.cu index 15d6e9cba5..ca7e9b95db 100644 --- a/src/main/cpp/src/cast_float_to_string.cu +++ b/src/main/cpp/src/cast_float_to_string.cu @@ -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);