You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bring sorn (set of real numbers / SORN encoding) to fully constexpr across all user-facing operators (construction, arithmetic, comparison, conversion). Part of the umbrella effort tracked in #723 to make every Universal number system constexpr-compliant for true plug-in semantics with native arithmetic types.
Bit-vector encoding that represents a set of intervals on the number line. Operations are mostly bitwise; should be tractable for constexpr.
Why
Constexpr arithmetic on a drop-in numeric type unlocks: compile-time coefficient tables (DSP, ML, scientific computing), static_assert numerical-bound checks, constinit constants for embedded targets, constant folding at low optimization levels, and drop-in parity with native int/float/double in any constexpr context.
Scope
Audit: walk include/sw/universal/number/sorn/ and inventory every operator's current constexpr status.
Construction: integer, float, double (and long double where supported) literals must work in constexpr context. Replace std::frexp/std::isnan/std::isinf with extractFields + raw-exponent checks where applicable (proven pattern from feat(posit): enable constexpr IEEE-754 construction (Phase 2 of #713) #717).
Goal
Bring
sorn(set of real numbers / SORN encoding) to fully constexpr across all user-facing operators (construction, arithmetic, comparison, conversion). Part of the umbrella effort tracked in #723 to make every Universal number system constexpr-compliant for true plug-in semantics with native arithmetic types.Bit-vector encoding that represents a set of intervals on the number line. Operations are mostly bitwise; should be tractable for constexpr.
Why
Constexpr arithmetic on a drop-in numeric type unlocks: compile-time coefficient tables (DSP, ML, scientific computing),
static_assertnumerical-bound checks,constinitconstants for embedded targets, constant folding at low optimization levels, and drop-in parity with nativeint/float/doublein anyconstexprcontext.Scope
include/sw/universal/number/sorn/and inventory every operator's currentconstexprstatus.constexprcontext. Replacestd::frexp/std::isnan/std::isinfwithextractFields+ raw-exponent checks where applicable (proven pattern from feat(posit): enable constexpr IEEE-754 construction (Phase 2 of #713) #717).+,-,*,/,%(where applicable) and compound forms.++,--.==,!=,<,<=,>,>=.operator float(),operator double(), etc.Prerequisites
Per-type analysis required during audit. Common prerequisites for this Epic:
blockbinaryarithmetic constexpr (already done for+= -= ++ <<= |=in feat(blockbinary): promote arithmetic operators to constexpr (PR 2 of #713) #716;*= /= %=may still need promotion).blocktriple/blocksignificandarithmetic constexpr where the type uses them.extractFields(alreadyBIT_CAST_CONSTEXPR) for IEEE-754 source extraction.std::is_constant_evaluated()dispatch for non-constexpr platform intrinsics.Acceptance
constexpr sorn<...> a(2.0), b(3.0); constexpr auto c = a + b;(and analogous for*,-,/,+=,<) compiles and produces correct bit pattern.static_assertsmoke tests in the type'sapi.cpp(orconstexpr.cpp) lock in the contract.Related
log2(relevant if this type uses log/exp transcendentals)