转自:http://blog.sina.com.cn/s/blog_8b5a0d0001011779.html

三角函数:(所有参数必须为弧度)
 
 1.acos

函数申明:acos  (double x);
   用途:用来返回给定的 X 的反余弦函数。

2.asin

函数申明:asin  (double x);
   用途:用来返回给定的 X 的反正弦函数。

3.atan

函数申明:atan  (double x);
   用途:用来返回给定的 X 的反正切函数。

4.sin

函数声明:sin   (double x);
   用途:用来返回给定的 X 的正弦值。

5.cos

函数声明:cos   (double x);
   用途:用来返回给定的 X 的余弦值。

6.tan

函数声明:tan   (double x);
   用途:用来返回给定的 X 的正切值。

7.atan2

函数声明:atan2 (double y, double x);
   用途:返回给定的 X 及 Y 坐标值的反正切值
 
其他函数:

8.atof

函数名: atof  (const char *s);
  功  能: 把字符串转换成浮点数
  用  法: double atof(const char *nptr);
  程序例:
   #i nclude <stdlib.h>
   #i nclude <stdio.h>

int main(void)
   {

float arg,*point=&arg;
    float f;
    char *str = "12345.67";

f = atof(str);
    printf("string = %s float = %f\n", str, f);
    return 0;
   }

9. ceil  和 floor

函数名: ceil  
                 floor 
   功  能: 向上舍入
        向下舍入
   用  法: double ceil(double x);
        double floor(double x);
   程序例:

#i nclude<math.h>

int main(void)
   {
    double number = 123.54;
    double down, up;

down = floor(number);
    up = ceil(number);

printf("original number     %5.2lf\n", number);
    printf("number rounded down %5.2lf\n", down);
    printf("number rounded up   %5.2lf\n", up);

return 0;
  }该程序运行结果:original number     123.54
                   number rounded down 123.00
                   number rounded up   124.00

10.fabs

函数名:fabs
    功能:求浮点数x的绝对值.
    用法:fabs  (double x);

11.fmod

函数名: fmod
    功  能: 计算x对y的模, 即x/y的余数
    用  法: double fmod(double x, double y);
    程序例:

#i nclude <stdio.h>
    #i nclude <math.h>

int main(void)
    {
     double x = 5.0, y = 2.0;
     double result;

result = fmod(x,y);
     printf("The remainder of (%lf / %lf) is \
          %lf\n", x, y, result);
     return 0;
    }

12.abs

函数名:abs
   功能:返回整型数的绝对值.
   用法:Abs(number)
        number 参数可以是任意有效的数值表达式。如果 number 包含 Null,则返回 Null;如果是未初始化变量,则返回 0.

幂指数:

13.exp

函数名:exp
    功能:返回 e 的 n 次幂.
    用法:exp   (double x);

14.frexp

函数名: frexp
    功  能: 把一个双精度数分解为尾数的指数
    用  法: double frexp(double value, int *eptr);
    程序例:

#i nclude <math.h>
    #i nclude <stdio.h>

int main(void)
    {
      double mantissa, number;
      int exponent;
      number = 8.0;
      mantissa = frexp(number, &exponent);
      printf("The number %lf is ", number);
      printf("%lf times two to the ", mantissa);
      printf("power of %d\n", exponent);
      return 0;
    }

15.log

函数名:log
    功 能: 自然对数函数ln(x) 
    用 法: double log(double x); 
    程序例:

#i nclude <math.h>
    #i nclude <stdio.h>
    int main(void) 
    { 
     double result; 
     double x = 8.6872; 
     result = log(x); 
     printf("The natural log of %lf is %lf\n", x, result); 
     return 0; 
    }

log(x,y)=ln(y)/ln(x)

16.ldexp

函数名: ldexp 
    功 能: 计算value*(2的exp幂 ).
    用 法: double ldexp(double value, int exp); 
    程序例: 
    #i nclude 
    #i nclude 
    int main(void) 
    { 
     double value; 
     double x = 2; 
 
     value = ldexp(x,3); 
     printf("The ldexp value is: %lf\n", value); 
     return 0; 
    } 运行结果为:2*2^3=16.
 
 17.log10

函数名:log10
    功能:返回以 10 为底的对数.
    用法:log10 (double x);

18.sqrt

函数名:sqrt
    功能:返回指定数字的平方根.
    用法:sqrt  (double x);

19.modf

函数名:modf
    功  能: 把数分为指数和尾数
    用  法: double modf(double value, double *iptr);
    程序例:
    #i nclude <math.h>
    #i nclude <stdio.h>
    int main(void)
   {
    double fraction, integer;
    double number = 100000.567;
    fraction = modf(number, &integer);
    printf("The whole and fractional parts of %lf are %lf and %lf\n",number, integer, fraction);
    return 0;
   }

20.pow

函数名:pow
    功能:返回指定数字的指定次幂.
    用法:pow   (double x, double y);(将返回x的y次幂)
 
双曲函数:
 
 21.cosh

函数名:cosh 
    功能:返回指定角度的双曲余弦值.
    用法:Double  Cosh(double x(以弧度计量的角度)) ;

22.sinh

函数名:sinh
    功能:返回指定角度的双曲正弦值。
    用法:sinh  (double x);(其中参数x必须为弧度制)
 
 23.tanh

函数名:tanh
    功能:回指定角度的双曲正切值.
    用法:tanh  (double x);

C语言常用数学函数及其用法的更多相关文章

  1. C语言入门(6)——C语言常用数学函数

    在编码过程中会经遇到数学运算,幸运的是C语言提供了非常丰富的数学函数库. 在数学中使用函数有时候书写可以省略括号,而C语言要求一定要加上括号,例如sin(pi/2)这种形式.在C语言的术语中,pi/2 ...

  2. R语言常用数学函数

    语言的数学运算和一些简单的函数整理如下: 向量可以进行那些常规的算术运算,不同长度的向量可以相加,这种情况下最短的向量将被循环使用.   > x <- 1:4 > a <- 1 ...

  3. VB.Net常用数学函数整理

      System.Math 类中定义了用于数学计算的函数.Math 类包括三角函数.对数函数和其他常用数学函数.下列函数是在 System 名称空间的 Math 类中定义的函数. 注意:要使用这些函数 ...

  4. php常用数学函数

    php常用数学函数1. bcadd 任意精度数的相加2. bcsub 任意精度数的减法3. bcmul 乘法, bcdiv除法 4. bcmod 取余数. (比%功能更强大)5. bcpow 幂函数运 ...

  5. C语言常用字符串函数

    string.h头文件中常用的函数 C 库函数 - strcat() char *strcat(char *dest, const char *src) 把 src 所指向的字符串追加到 dest 所 ...

  6. C/C++常用数学函数

    math.h/cmath(C++)数学函数库 1 三角函数    double sin (double);    double cos (double);    double tan (double) ...

  7. ios math.h 常用数学函数

    1. 三角函数  double sin (double);正弦  double cos (double);余弦  double tan (double);正切  2 .反三角函数  double as ...

  8. oracle常用数学函数

    数学函数 ABS:(返回绝对值) --返回绝对值 select abs(-1.11) from dual; CEIL:(向上取整) --向上取整 select ceil(3.1415) from du ...

  9. C语言:常用数学函数

    #include <stdio.h> #include <math.h> #include <stdlib.h> #include <time.h> # ...

随机推荐

  1. iOS 关于开发者证书:此证书的签发者无效的解决方案

    备注:第二个步骤一定要进行,否则弄到吐血,还是现实签发者无效 ---------------------- 1,按照你那个链接下载,https://developer.apple.com/certif ...

  2. dbartisan下载地址

    http://downloads.embarcadero.com/free/dbartisan

  3. 第一篇:APUE-操作系统IO模型

    操作系统IO模型   操作系统IO模型 声明:如下内容是根据APUE和mycat两本著作中关于I/O模式的一些内容加上自己的一些理解整理而成,仅供学习使用. 本节内容 UNIX下可用的五种I/O模型 ...

  4. C# 与 C++ 交互

    参考: http://www.cnblogs.com/liping13599168/archive/2011/03/31/2000320.html Platform Invoke Tutorial:h ...

  5. 《将博客搬至CSDN》的文章

    我的CSDN地址 博客园应该以后会很少来了.

  6. Java设计模式--单列设计模式

    设计模式:解决某一类问题行知最有效的方法.java有23种设计模式 单列设计模式: 解决一个类在内存中只存在一个对象 思路:(要保证对象的唯一性) 1.为了避免其它程序建立该对象,先禁止替他类创建改对 ...

  7. 浏览器兼容问题----Firefox不兼容event的解决方法

    一.event.srcElement:当前事件的源: 在IE下,event对象有srcElement属性,但是没有target属性;Firefox下,event对象有target属性,但是没有srcE ...

  8. CATransform3DRotate 实现左右,上下翻转效果

        CGFloat m34 = 800; CGFloat value = -40://(控制翻转角度) CGPoint point = CGPointMake(0.5, 0.5);//设定翻转时的 ...

  9. C++ sizeof总结

    关键字sizeof的作用是返回对象或类型占用的内存字节数,返回值是size_t. 基本数据类型占用的字节数:(32位系统) char 1字节 bool 1字节 short 2字节 int 4字节 lo ...

  10. ThinkPHP调试模式与日志记录

    1.可以在config.php中进行设置,默认为关闭状态. 'APP_DEBUG'   =>  true 打开\ThinkPHP\Common\debug.php文件可以查看debug的默认设置 ...