Erlang - cos函数



此方法返回指定值的余弦值。

语法

cos(X)

参数

X - 指定给余弦函数的值。

返回值

返回值是一个表示余弦值的浮点值。

例如

-module(helloworld). 
-import(math,[cos/1]). 
-export([start/0]). 

start() -> 
   Cosin = cos(45), 
   io:fwrite("~p~n",[Cosin]).

输出

运行上述程序后,将得到以下结果。

0.5253219888177297
erlang_numbers.htm
广告
© . All rights reserved.