Microsoft Specific

Emits the Streaming SIMD Extensions 2 (SSE2) instruction cvtsd2si. This instruction extracts a 64-bit floating point value and converts it to a signed 64-bit integer.

__int64 _mm_cvtsd_si64( 
   __m128d a

[in] a

A 128-bit parameter that contains a floating point value in the lower 64 bits.

The result can be expressed with the following equation:

r := CVT(ROUND(a0))





Header file <emmintrin.h>

r is the 64-bit signed integer result. a0 is the lower 64 bits of parameter a. The upper 64 bits of a are ignored.

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

#include <stdio.h>
#include <emmintrin.h>

int main ()
    __m128d a;

    a.m128d_f64[0] = 200.5;

    __int64 res = _mm_cvtsd_si64(a);

    printf_s("Original a: %I64f\n", a.m128d_f64[0]);
    printf_s("Result res: %I64d\n", res);

    return 0;
Original a: 200.500000
Result res: 200

Adiciones de comunidad