Java cos() 方法

Java 教程 · 2019-02-08 14:26:52

cos() 方法用于返回指定double类型参数的余弦值。

语法

double cos(double d)

参数

  • d -- 任何原生数据类型。

返回值

返回指定double类型参数的余弦值。

实例

public class Test{ 
    public static void main(String args[]){
    
        double degrees = 45.0;
        double radians = Math.toRadians(degrees);

        System.out.format("pi 的值为 %.4f%n", Math.PI);
        System.out.format("%.1f 度的余弦值为 %.4f%n", degrees, Math.cos(radians));

    }
}

编译以上程序,输出结果为:

pi 的值为 3.1416
45.0 度的余弦值为 0.7071

点击查看所有 Java 教程 文章: https://www.codercto.com/courses/l/12.html

查看所有标签

Google's PageRank and Beyond

Google's PageRank and Beyond

Amy N. Langville、Carl D. Meyer / Princeton University Press / 2006-7-23 / USD 57.50

Why doesn't your home page appear on the first page of search results, even when you query your own name? How do other web pages always appear at the top? What creates these powerful rankings? And how......一起来看看 《Google's PageRank and Beyond》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

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

RGB HEX 互转工具

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具