ftz shaders 0.0.1
HLSL 2021 interface
Loading...
Searching...
No Matches
ftz32.h File Reference

Uses the selected shader FTZ policy for canonical operands. More...

#include "ftz/config.h"
#include "ftz/ftz32_ops.h"

Go to the source code of this file.

Classes

struct  ftz::ftz32
 Canonical binary32 word wrapper with named HLSL imports and exports. Ordinary aggregate casts/default storage do not normalize or initialize a value; use from_bits(), from_float() or zero(). Treat bits_ as implementation storage. More...
struct  ftz::ftz32_sincos_result
 Paired HLSL trig values; sine precedes cosine. More...

Functions

ftz32 ftz::neg (ftz32 value)
 Flips the sign bit without floating-point arithmetic.
ftz32 ftz::abs (ftz32 value)
 Clears the sign bit without floating-point arithmetic.
ftz32 ftz::sqrt (ftz32 value)
 Returns the reciprocal-refined square-root approximation; signed zero and positive infinity are preserved, negative nonzero values give NaN.
ftz32 ftz::floor (ftz32 value)
 Rounds toward negative infinity, independently of the ambient rounding direction; retains signed zero and infinities.
ftz32 ftz::ceil (ftz32 value)
 Rounds toward positive infinity, independently of the ambient rounding direction; retains signed zero and infinities.
ftz32 ftz::trunc (ftz32 value)
 Rounds toward zero, independently of the ambient rounding direction; retains signed zero and infinities.
ftz32 ftz::sin (ftz32 value)
 Returns the reproducible sine approximation in radians; signed zero is preserved and infinity gives NaN.
ftz32 ftz::cos (ftz32 value)
 Returns the reproducible cosine approximation in radians; either zero gives one and infinity gives NaN.
template<unsigned int Degree = 6>
ftz32 ftz::exp (ftz32 value)
 Returns the reproducible exponential; negative infinity gives positive zero and positive infinity is preserved.
ftz32 ftz::expm1 (ftz32 value)
 Approximates exp(x)-1 without subtracting one for tiny x; signed zero is preserved.
ftz32 ftz::tanh (ftz32 value)
 Returns the reproducible hyperbolic tangent; signed zero is preserved and infinities give signed one.
ftz32 ftz::log (ftz32 value)
 Returns the natural-log approximation; either zero gives negative infinity, negative nonzero values give NaN.
ftz32 ftz::log1p (ftz32 value)
 Approximates log(1+x); -1 gives negative infinity, x below -1 gives NaN, and signed zero is preserved.
ftz32 ftz::atan2 (ftz32 y, ftz32 x)
 Returns the angle in radians for (y,x), retaining signed-axis and infinity quadrants; NaN inputs give NaN.
ftz32_sincos_result ftz::sincos (ftz32 value)
 Returns sine followed by cosine, sharing reduction; C++ uses a pair and HLSL uses named fields.
bool ftz::isnan (ftz32 value)
 Tests the encoded NaN class without floating-point arithmetic or quieting a signaling NaN.
bool ftz::isinf (ftz32 value)
 Tests for either signed infinity by its encoded bits.
bool ftz::isfinite (ftz32 value)
 Tests for zero or finite magnitude by its encoded bits.
bool ftz::signbit (ftz32 value)
 Tests the sign bit, including negative zero and signed NaNs.
ftz32 ftz::copysign (ftz32 value, ftz32 sign)
 Copies the second operand's sign to the first operand's magnitude, preserving the magnitude's NaN payload.
ftz32 ftz::fma (ftz32 a, ftz32 b, ftz32 c)
 Computes a*b+c with one fused rounding and the FTZ boundary repair.

Detailed Description

Uses the selected shader FTZ policy for canonical operands.

SPDX-FileType: SOURCE
SPDX-FileCopyrightText: 2026 Edward Kmett <ekmett@gmail.com>
SPDX-License-Identifier: BSD-2-Clause OR Apache-2.0
Author
Edward Kmett ekmett@gmail.com / HLSL 2021 FTZ value type, conversion factories, operators, and math overloads.

Definition in file ftz32.h.