MCPcopy Create free account
hub / github.com/apache/arrow / MaxDecimalDigitsForInteger

Function MaxDecimalDigitsForInteger

cpp/src/arrow/util/decimal.h:502–521  ·  view source on GitHub ↗

For an integer type, return the max number of decimal digits (=minimal decimal precision) it can represent.

Source from the content-addressed store, hash-verified

500/// For an integer type, return the max number of decimal digits
501/// (=minimal decimal precision) it can represent.
502inline Result<int32_t> MaxDecimalDigitsForInteger(Type::type type_id) {
503 switch (type_id) {
504 case Type::INT8:
505 case Type::UINT8:
506 return 3;
507 case Type::INT16:
508 case Type::UINT16:
509 return 5;
510 case Type::INT32:
511 case Type::UINT32:
512 return 10;
513 case Type::INT64:
514 return 19;
515 case Type::UINT64:
516 return 20;
517 default:
518 break;
519 }
520 return Status::Invalid("Not an integer type: ", type_id);
521}
522
523} // namespace arrow

Callers 1

CastBinaryDecimalArgsFunction · 0.85

Calls 1

InvalidFunction · 0.50

Tested by

no test coverage detected