We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.

_mm_floor_ps

Microsoft Specific

Emits the Streaming SIMD Extensions 4 (SSE4) instruction roundps. This instruction rounds the parameter down.

__m128 _mm_floor_ps( 
   __m128 a
);

[in] a

A 128-bit parameter that contains four 32-bit floating point values.

The result can be expressed with the following equations:

r0 := FLOOR(a0)
r1 := FLOOR(a1)
r2 := FLOOR(a2)
r3 := FLOOR(a3)

Intrinsic

Architecture

_mm_floor_ps

x86, x64

Header file <smmintrin.h>

r0-r3 and a0-a3 are the sequentially ordered 32-bit components of return value r and parameter a. r0 and a0 denote the least significant 32 bits.

This function is implemented as a macro that invokes _mm_round_ps.

Before you use this intrinsic, software must ensure that the processor supports the instruction.

#include <stdio.h>
#include <smmintrin.h>

int main ()
{
    __m128 a;

    a.m128_f32[0] = 0.0625;
    a.m128_f32[1] = -3.25;
    a.m128_f32[2] = 100.125;
    a.m128_f32[3] = -0.5;

    __m128 res = _mm_floor_ps(a);

    printf_s("Original a: %f\t%f\t%f\t%f\n",
                a.m128_f32[0], a.m128_f32[1], a.m128_f32[2], a.m128_f32[3]);
    printf_s("Result res: %f\t%f\t%f\t%f\n",
                res.m128_f32[0], res.m128_f32[1], res.m128_f32[2], res.m128_f32[3]);

    return 0;
}
Original a: 0.062500 -3.250000 100.125000 -0.500000 Result res: 0.000000 -4.000000 100.000000 -1.000000
Show: