mxnet
|
A faster implementation of strtof and strtod. More...
#include <type_traits>
#include <string>
#include <limits>
#include <cstdint>
#include "./base.h"
#include "./logging.h"
Go to the source code of this file.
Classes | |
class | dmlc::Str2T< T > |
Interface class that defines a single method get() to convert a string into type T. Define template specialization of this class to define the conversion method for a particular type. More... | |
class | dmlc::Str2T< int32_t > |
Template specialization of Str2T<> interface for signed 32-bit integer. More... | |
class | dmlc::Str2T< uint32_t > |
Template specialization of Str2T<> interface for unsigned 32-bit integer. More... | |
class | dmlc::Str2T< int64_t > |
Template specialization of Str2T<> interface for signed 64-bit integer. More... | |
class | dmlc::Str2T< uint64_t > |
Template specialization of Str2T<> interface for unsigned 64-bit integer. More... | |
class | dmlc::Str2T< float > |
Template specialization of Str2T<> interface for float type. More... | |
class | dmlc::Str2T< double > |
Template specialization of Str2T<> interface for double type. More... | |
Namespaces | |
dmlc | |
namespace for dmlc | |
Functions | |
bool | dmlc::isspace (char c) |
Inline implementation of isspace(). Tests whether the given character is a whitespace letter. More... | |
bool | dmlc::isblank (char c) |
Inline implementation of isblank(). Tests whether the given character is a space or tab character. More... | |
bool | dmlc::isdigit (char c) |
Inline implementation of isdigit(). Tests whether the given character is a decimal digit. More... | |
bool | dmlc::isalpha (char c) |
Inline implementation of isalpha(). Tests whether the given character is an alphabet letter. More... | |
bool | dmlc::isdigitchars (char c) |
Tests whether the given character is a valid letter in the string representation of a floating-point value, i.e. decimal digits, signs (+/-), decimal point (.), or exponent marker (e/E). More... | |
template<typename FloatType , bool CheckRange = false> | |
FloatType | dmlc::ParseFloat (const char *nptr, char **endptr) |
Common implementation for dmlc::strtof() and dmlc::strtod() TODO: the current version does not support hex number. More... | |
float | dmlc::strtof (const char *nptr, char **endptr) |
A faster implementation of strtof(). See documentation of std::strtof() for more information. Note that this function does not check for overflow. Use strtof_check_range() to check for overflow. TODO: the current version does not support hex number TODO: the current version does not handle long decimals: you may only have up to 19 digits after the decimal point, and you cannot have too many digits before the decimal point either. More... | |
float | dmlc::strtof_check_range (const char *nptr, char **endptr) |
A faster implementation of strtof(). See documentation of std::strtof() for more information. This function will check for overflow. If the converted value is outside the range for the float type, errno is set to ERANGE and HUGE_VALF is returned. TODO: the current version does not support hex number TODO: the current version does not handle long decimals: you may only have up to 19 digits after the decimal point, and you cannot have too many digits before the decimal point either. More... | |
double | dmlc::strtod (const char *nptr, char **endptr) |
A faster implementation of strtod(). See documentation of std::strtof() for more information. Note that this function does not check for overflow. Use strtod_check_range() to check for overflow. TODO: the current version does not support hex number TODO: the current version does not handle long decimals: you may only have up to 19 digits after the decimal point, and you cannot have too many digits before the decimal point either. More... | |
double | dmlc::strtod_check_range (const char *nptr, char **endptr) |
A faster implementation of strtod(). See documentation of std::strtod() for more information. This function will check for overflow. If the converted value is outside the range for the double type, errno is set to ERANGE and HUGE_VAL is returned. TODO: the current version does not support hex number TODO: the current version does not handle long decimals: you may only have up to 19 digits after the decimal point, and you cannot have too many digits before the decimal point either. More... | |
template<typename SignedIntType > | |
SignedIntType | dmlc::ParseSignedInt (const char *nptr, char **endptr, int base) |
A fast string-to-integer convertor, for signed integers TODO: the current version supports only base <= 10. More... | |
template<typename UnsignedIntType > | |
UnsignedIntType | dmlc::ParseUnsignedInt (const char *nptr, char **endptr, int base) |
A fast string-to-integer convertor, for unsigned integers TODO: the current version supports only base <= 10. More... | |
uint64_t | dmlc::strtoull (const char *nptr, char **endptr, int base) |
A faster implementation of strtoull(). See documentation of std::strtoull() for more information. Note that this function does not check for overflow. TODO: the current version supports only base <= 10. More... | |
long | dmlc::atol (const char *p) |
A faster implementation of atol(). See documentation of std::atol() for more information. This function will use base 10. Note that this function does not check for overflow. More... | |
float | dmlc::atof (const char *nptr) |
A faster implementation of atof(). Unlike std::atof(), this function returns float type. Note that this function does not check for overflow. TODO: the current version does not support hex number TODO: the current version does not handle long decimals: you may only have up to 19 digits after the decimal point, and you cannot have too many digits before the decimal point either. More... | |
float | dmlc::stof (const std::string &value, size_t *pos=nullptr) |
A faster implementation of stof(). See documentation of std::stof() for more information. This function will test for overflow and invalid arguments. TODO: the current version does not support hex number TODO: the current version does not handle long decimals: you may only have up to 19 digits after the decimal point, and you cannot have too many digits before the decimal point either. More... | |
double | dmlc::stod (const std::string &value, size_t *pos=nullptr) |
A faster implementation of stod(). See documentation of std::stod() for more information. This function will test for overflow and invalid arguments. TODO: the current version does not support hex number TODO: the current version does not handle long decimals: you may only have up to 19 digits after the decimal point, and you cannot have too many digits before the decimal point either. More... | |
template<typename T > | |
T | dmlc::Str2Type (const char *begin, const char *end) |
Convenience function for converting string into type T. More... | |
template<typename T1 , typename T2 > | |
int | dmlc::ParsePair (const char *begin, const char *end, const char **endptr, T1 &v1, T2 &v2) |
Parse colon seperated pair v1[:v2]. More... | |
template<typename T1 , typename T2 , typename T3 > | |
int | dmlc::ParseTriple (const char *begin, const char *end, const char **endptr, T1 &v1, T2 &v2, T3 &v3) |
Parse colon seperated triple v1:v2[:v3]. More... | |
Variables | |
const int | dmlc::kStrtofMaxDigits = 19 |
Maximum number of decimal digits dmlc::strtof() / dmlc::strtod() will process. Trailing digits will be ignored. More... | |
A faster implementation of strtof and strtod.
Copyright (c) 2015-2018 by Contributors