Erlang - float


Advertisements

The method converts a number to a float value.

Syntax

float(X)

Parameters

X - A number value.

Return Value

The return value is the float value of the number.

For example

-module(helloworld). 
-export([start/0]). 

start() ->
   Num = float(3), 
   io:fwrite("~f",[Num]).

Output

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

3.000000
erlang_numbers.htm
Advertisements