blob: b7a690fee918115419b2e8e61b34f7673ea0fcf8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
[;1m-spec float_to_binary(Float, Options) -> binary()[0m
[;1m when[0m
[;1m Float :: float(),[0m
[;1m Options :: [Option],[0m
[;1m Option ::[0m
[;1m {decimals, Decimals :: 0..253} |[0m
[;1m {scientific, Decimals :: 0..249} |[0m
[;1m compact.[0m
[;;4mSince[0m:
OTP R16B
Returns a binary corresponding to the text representation of [;;4m[0m
[;;4mFloat[0m using fixed decimal point formatting. [;;4mOptions[0m behaves in
the same way as [;;4mfloat_to_list/2[0m. Examples:
> float_to_binary(7.12, [{decimals, 4}]).
<<"7.1200">>
> float_to_binary(7.12, [{decimals, 4}, compact]).
<<"7.12">>
> float_to_binary(7.12, [{scientific, 3}]).
<<"7.120e+00">>
|