MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / safe_strtod

Function safe_strtod

tensorflow/core/lib/strings/numbers.cc:348–359  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

346}
347
348bool safe_strtod(StringPiece str, double* value) {
349 int processed_characters_count = -1;
350 auto len = str.size();
351
352 // If string length exceeds buffer size or int max, fail.
353 if (len >= kFastToBufferSize) return false;
354 if (len > std::numeric_limits<int>::max()) return false;
355
356 *value = StringToFloatConverter().StringToDouble(
357 str.data(), static_cast<int>(len), &processed_characters_count);
358 return processed_characters_count > 0;
359}
360
361size_t FloatToBuffer(float value, char* buffer) {
362 // FLT_DIG is 6 for IEEE-754 floats, which are used on almost all

Callers 10

AppendValueToExampleMethod · 0.85
ParamFromEnvWithDefaultFunction · 0.85
AddValueMethod · 0.85
BuildOutputMethod · 0.85
TESTFunction · 0.85
ProtoParseNumericFunction · 0.85
ComputeMethod · 0.85
SetValueMethod · 0.85
FieldToOutputMethod · 0.85

Calls 3

maxFunction · 0.50
sizeMethod · 0.45
dataMethod · 0.45

Tested by 2

TESTFunction · 0.68