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

Function safe_strtof

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

Source from the content-addressed store, hash-verified

333}
334
335bool safe_strtof(StringPiece str, float* value) {
336 int processed_characters_count = -1;
337 auto len = str.size();
338
339 // If string length exceeds buffer size or int max, fail.
340 if (len >= kFastToBufferSize) return false;
341 if (len > std::numeric_limits<int>::max()) return false;
342
343 *value = StringToFloatConverter().StringToFloat(
344 str.data(), static_cast<int>(len), &processed_characters_count);
345 return processed_characters_count > 0;
346}
347
348bool safe_strtod(StringPiece str, double* value) {
349 int processed_characters_count = -1;

Callers 14

MainFunction · 0.85
GetOneFloatParameterMethod · 0.85
ExtractMinMaxRecordsFunction · 0.85
FloatToBufferFunction · 0.85
TESTFunction · 0.85
ProtoParseNumericFunction · 0.85
ComputeMethod · 0.85
LoadFromFileMethod · 0.85
ReadCSVFileToArrayOrDieFunction · 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
ReadCSVFileToArrayOrDieFunction · 0.68