aboutsummaryrefslogtreecommitdiffstats
path: root/erts/doc/src
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2013-01-23 17:03:41 +0100
committerBjörn-Egil Dahlberg <[email protected]>2013-01-23 17:03:41 +0100
commitd5bc1c71f756114d3110328d57e4f0545e144577 (patch)
tree11c95b7af28a060cffda5733d3043ffea707e798 /erts/doc/src
parent4c97cddddbe7c193953dbb58c342069330e3324c (diff)
parentab27e8699ef2a2bafe574158200993f184de3dc2 (diff)
downloadotp-d5bc1c71f756114d3110328d57e4f0545e144577.tar.gz
otp-d5bc1c71f756114d3110328d57e4f0545e144577.tar.bz2
otp-d5bc1c71f756114d3110328d57e4f0545e144577.zip
Merge branch 'sal/float_to_list_2/OTP-10752'
* sal/float_to_list_2/OTP-10752: Text representation of a float formatted using given options.
Diffstat (limited to 'erts/doc/src')
-rw-r--r--erts/doc/src/erlang.xml31
1 files changed, 31 insertions, 0 deletions
diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml
index ce59908036..d09f286e36 100644
--- a/erts/doc/src/erlang.xml
+++ b/erts/doc/src/erlang.xml
@@ -968,6 +968,37 @@ true
</desc>
</func>
<func>
+ <name>float_to_list(Float, Options) -> string()</name>
+ <fsummary>Text representation of a float formatted using given options</fsummary>
+ <type>
+ <v>Float = float()</v>
+ <v>Options = [Option]</v>
+ <v>Option = {decimals, Decimals::0..249} |
+ {scientific, Decimals::0..249} |
+ compact</v>
+ </type>
+ <desc>
+ <p>Returns a string which corresponds to the text
+ representation of <c>Float</c> using fixed decimal point formatting.
+ When <c>decimals</c> option is specified
+ the returned value will contain at most <c>Decimals</c> number of
+ digits past the decimal point. If the number doesn't fit in the
+ internal static buffer of 256 bytes, the function throws <c>badarg</c>.
+ When <c>compact</c> option is provided
+ the trailing zeros at the end of the list are truncated (this option is
+ only meaningful together with the <c>decimals</c> option). When
+ <c>scientific</c> option is provided, the float will be formatted using
+ scientific notation with <c>Decimals</c> digits of precision. If
+ <c>Options</c> is <c>[]</c> the function behaves like <c>float_to_list/1</c>.
+ </p>
+ <pre>
+> <input>float_to_list(7.12, [{decimals, 4}]).</input>
+"7.1200"
+> <input>float_to_list(7.12, [{decimals, 4}, compact]).</input>
+"7.12"</pre>
+ </desc>
+ </func>
+ <func>
<name name="fun_info" arity="1"/>
<fsummary>Information about a fun</fsummary>
<desc>