Microsoft Specific

Emits the Streaming SIMD Extensions 4 (SSE4) instruction roundsd. This instruction rounds up a double precision floating point value.

__m128d _mm_ceil_sd( 
   __m128d a,
   __m128d b


  • [in] a
    A 128-bit parameter that contains two 64-bit floating point values.

  • [in] b
    A 128-bit parameter that contains a 64-bit floating point value in the low quadword.

Return value

r0 := CEIL(b0)
r1 := a1





x86, x64

Header file <smmintrin.h>


r0, a0, and b0 are the low order 64 bits of return value r and parameters a and b.

r1, a1, and b0 are the high order 64 bits of return value r and parameters a and b.

This function is implemented as a macro that invokes intrinsic _mm_round_sd with appropriate rounding control.

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


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

int main () {
    __m128d a;
    __m128d b;

    a.m128d_f64[1] = 10.4;
    a.m128d_f64[0] = -6.5;
    b.m128d_f64[1] = 0;
    b.m128d_f64[0] = 625.57;

    __m128d res = _mm_ceil_sd( a, b );

    printf_s("Original a: %10f %10f\nOriginal b: %10f %10f\n",
                a.m128d_f64[1], a.m128d_f64[0],
                b.m128d_f64[1], b.m128d_f64[0]);

    printf_s("Result res: %10f %10f\n",
               res.m128d_f64[1], res.m128d_f64[0]);

    return 0;
Original a:  10.400000  -6.500000
Original b:   0.000000 625.570000
Result res:  10.400000 626.000000

See Also


Compiler Intrinsics