Erlang - cos



This method returns the cosine of the specified value.

Syntax

cos(X)

Parameters

X - A value is specified for the cosine function.

Return Value

The return value is a float value representing the cosine value.

For example

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

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

Output

When we run the above program, we will get the following result.

0.5253219888177297
erlang_numbers.htm
Advertisements