Java acos() 方法

Java 教程 · 2019-02-08 15:14:50

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

语法

double acos(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("%.4f 的反余弦值为 %.4f 度 %n", Math.cos(radians), Math.toDegrees(Math.acos(Math.sin(radians))));

    }
}

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

pi 的值为 3.1416
0.7071 的反余弦值为 45.0000 度 

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

查看所有标签

Algorithms Illuminated (Part 2)

Algorithms Illuminated (Part 2)

Tim Roughgarden / Soundlikeyourself Publishing, LLC / 2018-8-5 / USD 17.99

Algorithms are the heart and soul of computer science. Their applications range from network routing and computational genomics to public-key cryptography and machine learning. Studying algorithms can......一起来看看 《Algorithms Illuminated (Part 2)》 这本书的介绍吧!

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

在线 XML 格式化压缩工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具