C 库函数 - sin()

C 语言教程 · 2019-02-23 07:28:02

描述

C 库函数 double sin(double x) 返回弧度角 x 的正弦。

声明

下面是 sin() 函数的声明。

double sin(double x)

参数

  • x -- 浮点值,代表了一个以弧度表示的角度。

返回值

该函数返回 x 的正弦。

实例

下面的实例演示了 sin() 函数的用法。

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

#define PI 3.14159265

int main ()
{
   double x, ret, val;

   x = 45.0;
   val = PI / 180;
   ret = sin(x*val);
   printf("%lf 的正弦是 %lf 度", x, ret);
   
   return(0);
}

让我们编译并运行上面的程序,这将产生以下结果:

45.000000 的正弦是 0.707107 度

点击查看所有 C 语言教程 文章: https://codercto.com/courses/l/17.html

查看所有标签

Python for Everyone

Python for Everyone

Cay S. Horstmann、Rance D. Necaise / John Wiley & Sons / 2013-4-26 / GBP 181.99

Cay Horstmann's" Python for Everyone "provides readers with step-by-step guidance, a feature that is immensely helpful for building confidence and providing an outline for the task at hand. "Problem S......一起来看看 《Python for Everyone》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试