Namespaces
Variants
Actions

Talk:cpp/string/basic string/stoul

From cppreference.com

what happens if base > 36 ? (yes, I'm paranoid ;-)

the standard defines no behavior, which is another way to say "the behavior is undefined". In particular, gcc appears to use an uninitialized variable, making it truly undefined. --Cubbi (talk) 07:31, 26 September 2015 (PDT)
[edit] ======================================================================

I think this function isn't accurate eg: 36^10=3656158440062980

but when i use this function: std::string s1( "10000000000" ); std::cout << s1 << " ===> " << std::stoull( s1, 0, 36 ) << std::endl; I get:


10000000000 ===> 3656158440062976

btw even if i assume the implmentation first converts to binary we still do NOT overflow using only 53 digits. really don't get that..

36^10 is 3656158440062976, see for example wolfram alpha --Cubbi (talk) 12:38, 5 April 2017 (PDT)