我要评分
获取效率
正确性
完整性
易理解

llrint

Return the rounded value in long long int format based on the current rounding mode.

Interface Definition

C interface:

long long int llrintf(float x);

long long int llrint(double x);

Parameters

Parameter

Type

Description

Input/Output

x

  • For llrintf, x is of single-precision floating-point type.
  • For llrint, x is of double-precision floating-point type.

Floating-point value of the input data.

Input

Return Value

The rounded value of x is returned. x ∈ (-inf, inf)

Dependency

C: "km.h"

Example

C interface:
    // typical usage
    printf("llrint(0.0) = %lld\n", llrint(0.0));
    printf("llrint(-0.0) = %lld\n", llrint(-0.0));
    printf("llrint(1.0) = %lld\n", llrint(1.0));
    printf("llrint(1.4) = %lld\n", llrint(1.4));
    printf("llrint(1.5) = %lld\n", llrint(1.5));
    printf("llrint(-3.0) = %lld\n", llrint(-3.0));
    printf("llrint(-3.4) = %lld\n", llrint(-3.4));
    printf("llrint(-3.5) = %lld\n", llrint(-3.5));

result
    /* 
     * llrint(0.0) = 0
     * llrint(-0.0) = 0
     * llrint(1.0) = 1
     * llrint(1.4) = 1
     * llrint(1.5) = 2
     * llrint(-3.0) = -3
     * llrint(-3.4) = -3
     * llrint(-3.5) = -4
     * */