jaxpint.dual_float#
DualFloat: Faux long double via integer + fractional part split.
Represents a value as the sum of an integer part and a fractional part, each stored in float64. This gives ~30 digits of precision for values that would otherwise lose low-order bits in a single float64.
Two normalization conventions are supported via factory methods:
- DualFloat.cycles(): frac in [-0.5, 0.5), for phase (cycles)
- DualFloat.days(): frac in [0, 1), for MJD / time (days)
- class jaxpint.dual_float.DualFloat(int, frac)[source]#
Bases:
ModuleA value split into integer and fractional parts for extended precision.
Both fields are float64 JAX arrays of the same shape. The fractional part’s range depends on which factory method was used to create the instance, but arithmetic always normalizes to [-0.5, 0.5) (cycles convention).
- Parameters:
int (Float[Array, '...'])
frac (Float[Array, '...'])
- int: Float[Array, '...']#
- frac: Float[Array, '...']#
- static cycles(int_part, frac_part)[source]#
Create a DualFloat, normalizing frac to [-0.5, 0.5).
Suitable for phase (cycles). Assumes
int_partholds integer values. Iffrac_partis outside [-0.5, 0.5), the overflow is carried into the integer part.- Parameters:
int_part (Float[Array, '...'])
frac_part (Float[Array, '...'])
- Return type:
- static days(int_part, frac_part)[source]#
Create a DualFloat, normalizing frac to [0, 1).
Suitable for MJD / time values (days). Overflow from the fractional part is carried into the integer part.
- Parameters:
int_part (Float[Array, '...'])
frac_part (Float[Array, '...'])
- Return type:
- property total: Float[Array, '...']#
Collapse int + frac into a single float64 array.
Safe when
intis small (e.g. phase residuals, time differences of a few days). Unsafe whenintis large (e.g. absolute MJD ~60000 or absolute phase ~10^10 cycles) — the addition discards the low-order bits offrac.