字符串转换为数字函数:

atoi(str):str最大为:2^31 - 1  //返回值为int类型

atol(str):str最大为:2^63 - 1 //返回值为long long类型

atof(str):str最大为:1.79769e+308 //返回值为double类型

对于上面几个函数,str过大都会返回其最大值,如atoi会返回2^31 - 1

 

double能表示的最大值:1.79769e+308

测试方法最大值方法:

#include <stdio.h>

std::cout << DBL_MAX << std::endl;

#include <limits>

std::cout << std::numeric_limits<double>::max() << std::endl;

相关文章:

  • 2022-12-23
  • 2021-07-10
  • 2021-09-07
  • 2021-06-19
  • 2022-12-23
  • 2021-05-23
  • 2022-12-23
猜你喜欢
  • 2021-06-11
  • 2021-12-16
  • 2021-10-04
  • 2021-10-01
  • 2021-05-21
  • 2021-09-03
  • 2022-12-23
相关资源
相似解决方案