Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions cpp/src/arrow/util/value_parsing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,11 @@ bool StringToFloat(const char* s, size_t length, char decimal_point, uint16_t* o
float temp_out;
const auto res =
::arrow_vendored::fast_float::from_chars_advanced(s, s + length, temp_out, options);
*out = Float16::FromFloat(temp_out).bits();
return res.ec == std::errc() && res.ptr == s + length;
const bool ok = res.ec == std::errc() && res.ptr == s + length;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

res.ptr == s + length changes the logic for parsing?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's just that otherwise the result is a failure and there is no need to do the final conversion to float16.

if (ok) {
*out = Float16::FromFloat(temp_out).bits();
}
return ok;
}

// ----------------------------------------------------------------------
Expand Down