lrint
基于当前舍入策略,以long int形式返回舍入值。
接口定义
C interface:
long int lrintf(float x);
long int lrint(double x);
long int llrintl(long double x);
参数
参数名 |
类型 |
描述 |
输入/输出 |
---|---|---|---|
x |
|
表示输入数据的浮点值。 |
输入 |
返回值
返回x的舍入值,x ∈ (-inf, inf)。
依赖
C: "km.h"
示例
C interface:
// typical usage printf("lrint(0.0) = %lld\n", lrint(0.0)); printf("lrint(-0.0) = %lld\n", lrint(-0.0)); printf("lrint(1.0) = %lld\n", lrint(1.0)); printf("lrint(1.4) = %lld\n", lrint(1.4)); printf("lrint(1.5) = %lld\n", lrint(1.5)); printf("lrint(-3.0) = %lld\n", lrint(-3.0)); printf("lrint(-3.4) = %lld\n", lrint(-3.4)); printf("lrint(-3.5) = %lld\n", lrint(-3.5)); result /* * lrint(0.0) = 0 * lrint(-0.0) = 0 * lrint(1.0) = 1 * lrint(1.4) = 1 * lrint(1.5) = 2 * lrint(-3.0) = -3 * lrint(-3.4) = -3 * lrint(-3.0) = -4 * */
父主题: 舍入函数