• Slang Standard Library Reference
    • Interfaces
    • Types
    • Attributes
    • Global Declarations
      • Atomic functions
      • Memory and control barriers
      • Bit operation functions
      • Conversion functions
        • asdouble
        • asfloat
        • asfloat16
        • asint
        • asint16
        • asuint
        • asuint16
        • bit_cast
        • f16tof32
        • f32tof16
        • f32tof16_
        • reinterpret
      • Derivative functions
      • Math functions
      • Mesh shading
      • Ray-tracing
      • Tessellation functions
      • Wave and quad functions
      • CheckAccessFullyMapped
      • D3DCOLORtoUBYTE4
      • EvaluateAttributeAtCentroid
      • EvaluateAttributeAtSample
      • EvaluateAttributeSnapped
      • GetAttributeAtVertex
      • GetRenderTargetSampleCount
      • GetRenderTargetSamplePosition
      • IsHelperLane
      • NonUniformResourceIndex
      • ReorderThread
      • WorkgroupSize
      • abort
      • all
      • any
      • clip
      • concat
      • createDynamicObject
      • cudaBlockDim
      • cudaBlockIdx
      • cudaThreadIdx
      • debugBreak
      • getRealtimeClock
      • getRealtimeClockLow
      • getStringHash
      • makeTuple
      • nextafter
      • printf
      • select
      • static_assert
      • unmodified
      • unused

f32tof16

Description

Convert to 16-bit float stored in low bits of integer.

Signature

uint f32tof16(float value);

vector<uint, N> f32tof16<N:int>(vector<float, N> value);

Generic Parameters

N : int

Parameters

value : float

value : vector<float, N>

Availability and Requirements

Defined for the following targets:

hlsl

Available in all stages.

glsl

Available in all stages.

cpp

Available in all stages.

cuda

Available in all stages.

metal

Available in all stages.

wgsl

Available in all stages.

spirv

Available in all stages.