Skip to content

Commit

Permalink
Automated Code Change
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 710000524
  • Loading branch information
tensorflower-gardener authored and copybara-github committed Dec 27, 2024
1 parent 16500ff commit ee03d6d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion tsl/platform/numbers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ size_t FloatToBuffer(float value, char* buffer) {
DCHECK(snprintf_result > 0 && snprintf_result < kFastToBufferSize);

float parsed_value;
if (!safe_strtof(buffer, &parsed_value) || parsed_value != value) {
if (!absl::SimpleAtof(buffer, &parsed_value) || parsed_value != value) {
snprintf_result =
snprintf(buffer, kFastToBufferSize, "%.*g", FLT_DIG + 3, value);

Expand Down
12 changes: 6 additions & 6 deletions tsl/platform/numbers.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,27 +136,27 @@ inline bool safe_strtod(absl::string_view str, double* value) {
}

inline bool ProtoParseNumeric(absl::string_view s, int32_t* value) {
return safe_strto32(s, value);
return absl::SimpleAtoi(s, value);
}

inline bool ProtoParseNumeric(absl::string_view s, uint32_t* value) {
return safe_strtou32(s, value);
return absl::SimpleAtoi(s, value);
}

inline bool ProtoParseNumeric(absl::string_view s, int64_t* value) {
return safe_strto64(s, value);
return absl::SimpleAtoi(s, value);
}

inline bool ProtoParseNumeric(absl::string_view s, uint64_t* value) {
return safe_strtou64(s, value);
return absl::SimpleAtoi(s, value);
}

inline bool ProtoParseNumeric(absl::string_view s, float* value) {
return safe_strtof(s, value);
return absl::SimpleAtof(s, value);
}

inline bool ProtoParseNumeric(absl::string_view s, double* value) {
return safe_strtod(s, value);
return absl::SimpleAtod(s, value);
}

// Convert strings to number of type T.
Expand Down

0 comments on commit ee03d6d

Please sign in to comment.