category

ieee_754_common(Precision,ByteOrder)

Shared IEEE 754 exact bit and byte handling predicates for the high-level codec and low-level field inspection objects.

Availability:
logtalk_load(ieee_754(loader))
Author: Paulo Moura
Version: 1:1:0
Date: 2026-08-04
Compilation flags:
static
Remarks:
(none)
Inherited public predicates:
(none)

Public predicates

(no local declarations; see entity ancestors if any)

Protected predicates

source_bits/2

Validates and normalizes a source term into canonical-order unsigned integer bits for the selected precision and byte order.

Compilation flags:
static
Template:
source_bits(Source,Bits)
Mode and number of proofs:
source_bits(++compound,--integer) - one_or_error
Exceptions:
Source is a variable:
instantiation_error
Source is not a variable but uses bytes(Bytes) or bits(Bits) with an encoding incompatible with the selected precision:
domain_error(ieee_754_encoding,Source)
Source is not a valid IEEE 754 source term:
domain_error(ieee_754_source,Source)

bits_fields/5

Extracts exact IEEE 754 sign, exponent bits, mantissa bits, and a class atom from a validated bit pattern.

Compilation flags:
static
Template:
bits_fields(Bits,Sign,ExponentBits,MantissaBits,Class)
Mode and number of proofs:
bits_fields(+integer,-integer,-integer,-integer,-atom) - one

bits_finite_binary_rational/4

Extracts an exact finite IEEE 754 value from a validated bit pattern as (-1)^Sign * Significand * 2^Exponent.

Compilation flags:
static
Template:
bits_finite_binary_rational(Bits,Sign,Significand,Exponent)
Mode and number of proofs:
bits_finite_binary_rational(+integer,-integer,-integer,-integer) - zero_or_one

bits_nan_payload/2

Extracts the raw NaN mantissa payload bits from a validated bit pattern.

Compilation flags:
static
Template:
bits_nan_payload(Bits,PayloadBits)
Mode and number of proofs:
bits_nan_payload(+integer,-integer) - zero_or_one

bits_nan_kind/2

Classifies a validated NaN bit pattern as quiet or signaling using the quiet/signaling discriminator bit for the selected precision.

Compilation flags:
static
Template:
bits_nan_kind(Bits,Kind)
Mode and number of proofs:
bits_nan_kind(+integer,-atom) - zero_or_one

canonical_nan_bits/1

Returns the canonical quiet NaN bit pattern for the selected precision.

Compilation flags:
static
Template:
canonical_nan_bits(Bits)
Mode and number of proofs:
canonical_nan_bits(-integer) - one

nan_bits/1

True when the validated bit pattern encodes a NaN value for the selected precision.

Compilation flags:
static
Template:
nan_bits(Bits)
Mode and number of proofs:
nan_bits(+integer) - zero_or_one

valid_bits/1

True when the integer fits in the selected precision bit width.

Compilation flags:
static
Template:
valid_bits(Bits)
Mode and number of proofs:
valid_bits(+integer) - zero_or_one

zero_bits/2

Returns the zero encoding bits with the requested sign bit.

Compilation flags:
static
Template:
zero_bits(Sign,Bits)
Mode and number of proofs:
zero_bits(+integer,-integer) - one

zero_from_sign/2

Constructs a positive or negative floating-point zero from a sign bit.

Compilation flags:
static
Template:
zero_from_sign(Sign,Zero)
Mode and number of proofs:
zero_from_sign(+integer,-float) - one

apply_float_sign/3

Applies a sign bit to a positive floating-point magnitude.

Compilation flags:
static
Template:
apply_float_sign(Sign,Magnitude,Value)
Mode and number of proofs:
apply_float_sign(+integer,+float,-float) - one

precision_spec/5

Returns the exponent width, mantissa width, exponent bias, and byte count for a supported IEEE 754 precision.

Compilation flags:
static
Template:
precision_spec(Precision,ExponentWidth,MantissaWidth,Bias,ByteCount)
Mode and number of proofs:
precision_spec(+atom,-integer,-integer,-integer,-integer) - one

Private predicates

(no local declarations; see entity ancestors if any)

Operators

(none)