REAL¶
The ASN.1 REAL type represents a floating-point number, optionally including
special values such as PLUS-INFINITY, MINUS-INFINITY, and NOT-A-NUMBER (NaN),
depending on the encoding rules used.
In Python, the generated REAL class wraps the native float type, providing
encoding, decoding, and constraint checks compliant with ASN.1 rules.
Example ASN.1 definition:
MyReal ::= REAL
which generates a Python class roughly equivalent to:
class MyReal(_Asn1BasicType[float]):
pass
Conceptual Representation¶
- class _Asn1BasicType[float]
Represents a REAL ASN.1 type.
- __init__(self, value: float | None = None) None
Initializes the REAL instance with an optional initial value.
The value may be any Python object coercible to a floating-point number.
- property value: float
Gets or sets the floating-point value.
Setting the value accepts any Python number type or a string representing a number in decimal or scientific notation.
Special Considerations¶
Some ASN.1 encoding rules allow representation of infinities and NaN, which are mapped directly to their Python
floatequivalents.Precision and range depend on the underlying platform’s floating-point implementation (IEEE 754 double-precision on most systems).