一些常用的C++標準函數

來源:互聯網
上載者:User

標籤:

一些常用的C++標準函數


  double atof(const char* p);
  int atoi(const char* p);
  long atol(const char* p);cstdlib把字串p轉化成所表示的數與Val類似

  double fabs(double);                           // cmath絕對值函數與abs類似

  double ceil(double);                            // cmath 取整函數,向上取整
  double floor(double);                          // cmath取整函數,向下取整
  double sqrt(double);                          // cmath平方根函數
  double pow(double d, double e);         // cmath冪函數,返回d的e次方


  double sin(double);                            // cmath 三角函數 
  double cos(double);
  double tan(double); 
  double asin(double);                          // cmath 反三角函數 
  double acos(double);
  double atan(double); 
  double atan2(double y, double x);       // cmath增強型反正切函數,返回點(x, y)的輻角很有用,會根據點所在的象限調整弧度值
  double sinh(double);                          // cmath 雙曲函數 
  double cosh(double);
  double tanh(double); 


  double exp(double);                          // cmath指數函數,以e為底
  double log(double);                           // cmath 對數函數,以e為底
  double log10(double);                       // cmath對數函數,以10為底


  另外,標準C++中並沒有提供函數Pi,要獲得Pi的值一般這樣做:
  const double pi = acos(0.) * 2;

 

 

來自http://bbs.tianya.cn/post-itinfo-181747-1.shtml

一些常用的C++標準函數

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.