From 1b2cea397131a36a39b18c6ce8c6944bf11db4c7 Mon Sep 17 00:00:00 2001 From: Filipe David Manana Date: Mon, 16 May 2011 17:00:25 +0100 Subject: Add erlang:external_size/2 BIF This BIF's second parameter is a list of options. Currently the only allowed option is {minor_version, Version} where version is either 0 (default) or 1. --- erts/doc/src/erlang.xml | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'erts/doc/src') diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml index ad7a57bd73..84d4160e6a 100644 --- a/erts/doc/src/erlang.xml +++ b/erts/doc/src/erlang.xml @@ -1034,6 +1034,56 @@ b exit reason killed.

+ + erlang:external_size(Term) -> integer() >= 0 + Calculate the maximum size for a term encoded in the Erlang + external term format + + Term = term() + + +

Calculates, without doing the encoding, the maximum byte size for + a term encoded in the Erlang external term format. The following + condition applies always:

+

+

+> Size1 = byte_size(term_to_binary(Term)),
+> Size2 = erlang:external_size(Term),
+> true = Size1 =< Size2.
+true
+          
+

+

This is equivalent to a call to: erlang:external_size(Term, []) +

+
+
+ + erlang:external_size(Term, [Option]) -> integer() >= 0 + Calculate the maximum size for a term encoded in the Erlang + external term format + + Term = term() + Option = {minor_version, Version} + + +

Calculates, without doing the encoding, the maximum byte size for + a term encoded in the Erlang external term format. The following + condition applies always:

+

+

+> Size1 = byte_size(term_to_binary(Term, Options)),
+> Size2 = erlang:external_size(Term, Options),
+> true = Size1 =< Size2.
+true
+          
+

+

The option {minor_version, Version} specifies how floats + are encoded. See + term_to_binary/2 for + a more detailed description. +

+
+
float(Number) -> float() Convert a number to a float -- cgit v1.2.3