ASN.1 REAL tag: 09

The ASN.1 REAL type is used to represent real (floating point) values. The REAL type defines real values according to the formula m * be, where m is the mantissa, b the base (either 2 or 10), and e the exponent. The value notation for REALs must specify a value for each of these three parts. This is done by enclosing the values in curly brackets ( "{" and "}" ) in the order m, b, e, with the identifiers mantissa, base, exponent respectively.


The following example represents the value 314159 * 10-5, or 3.14159. Two special REAL values are also defined: PLUS-INFINITY and MINUS-INFINITY, which represent the values +∞ or -∞.

pi REAL ::= {314159, 10, -5}                        --1990
pi REAL ::= {mantissa 314159, base 10, exponent -5} --1994
gooseEgg REAL ::= 0
newpi REAL ::= 3.14159                              --2001
REAL encoding example

To encode a real value, each of the values M, B, and E must be encoded.

Value ::= REAL
ten Value ::= { 10, 2, 0 }

In BER, the REAL type value defined in the example above is encoded as follows:

09 03 80 00 0A


The REAL type can be constrained by a single value, by type inclusion, and by value range constraints.

Related Topics