|
| template<floating_point Type> |
| constexpr auto | sbx::math::mix (const Type x, const Type y, const Type a) -> Type |
| | Linearly interpolates between two values. More...
|
| |
| template<floating_point Type> |
| constexpr auto | sbx::math::abs (const Type value) -> Type |
| | Computes the absolute value. More...
|
| |
| template<floating_point Type> |
| constexpr auto | sbx::math::sqrt (const Type value) -> Type |
| | Computes the square root using iterative refinement. More...
|
| |
Generic math algorithms and helpers.
This header provides small, constexpr-friendly utilities for common mathematical operations on floating-point types. Implementations are provided in the accompanying .ipp file.
- Author
- KAJ
- Copyright
- (C) 2026 Jonas Kabelitz
template<floating_point Type>
| constexpr auto sbx::math::sqrt |
( |
const Type |
value | ) |
-> Type |
|
inlineconstexpr |
Computes the square root using iterative refinement.
This implementation uses Newton iteration to approximate the square root.
For negative inputs and positive infinity, this function returns quiet_NaN().
- Template Parameters
-
- Parameters
-
- Returns
- Square root approximation, or NaN for invalid inputs.