-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Description
Description
I want to propose disabling promotion to from double
to long double
by default in Boost's math functions due to performance implications and architectural differences between platforms. Users who need higher precision can enable promotion with a policy.
Boost documentation on type promotion: https://live.boost.org/doc/libs/1_44_0/libs/math/doc/sf_and_dist/html/math_toolkit/policy/pol_ref/internal_promotion.html
Current Behavior
- On x86_64: Promotes to 80-bit extended precision
long double
(15-bit exponent, 63-bit precision) - On aarch64: Promotes to 128-bit quadruple precision
long double
(15-bit exponent, 112-bit precision). The ARMv8 ISA does not define a floating point type wider than 64 bits and so GCC uses a soft float implementation for the quadruple precision, 128-bit float.
Issues with Current Behavior
-
Performance Impact
- Significant performance overhead from promotion to
long double
- Larger performance delta between architectures (e.g., x86_64 vs aarch64) compared to standard library implementations
- Significant performance overhead from promotion to
-
Architectural Inconsistency
- Different precision levels between platforms (63 bits vs 112 bits)
- Potentially unexpected behavior when moving code between architectures
-
Limited Benefit
- Numerical differences at these precision levels are typically negligible for most use cases
- Most applications that truly need extended precision would explicitly specify it
Metadata
Metadata
Assignees
Labels
No labels