ValueDouble

class dsviper.ValueDouble(initial_value=None)

Bases: Value

A value of type double. Seamless with a Python float.

NaN is a single data-model value here, not the IEEE 754 artefact: NaN equals NaN, hashes deterministically, and sits at one end of the total order, below -inf. That is what lets a NaN be found in a set, deduplicated as a map key, and seen by a diff. Arithmetic stays IEEE 754: read the float back with encoded(). ValueDouble.NAN, .INF and .NEG_INF name the three. Or use Value.create(Type.DOUBLE [, initial_value]).

INF = inf
NAN = nan
NEG_INF = -inf
ONE = 1.0
ZERO = 0.0
static cast(value: Value | _OutputValues) → ValueDouble

Return value as a double, or raise if it is not one.

copy() → ValueDouble

Return a deep copy.

description(*, namespace: NameSpace | None = None) → str

Return the value written out, then its type, as <value>:<type>.

namespace qualifies the type name; representation() gives the value alone.

encoded() → float

Return a Python float.

hash() → int

Return the hash value.

representation() → str

Return the value written out: the number, in decimal.

static try_parse(string: str) → ValueDouble | None

Return string parsed as a double, or None if it does not parse.

type() → Type

Return the Type this value is an instance of.

type_code() → str

Return the code naming this kind of value, such as “int32”, “struct” or “vector”.