当前位置: 老葡京网站娱乐 > 编程语言 > C语言 > 正文

C语言函数大全(l开头)

时间:2010-01-29

老葡京网站娱乐 www.sdguanhua.com 函数名: labs

用法: long labs(long n);

程序例:

#include
#include
int main(void)
{
long result;
long x = -12345678L;
result= labs(x);
printf("number: %ld abs value: %ld\n",
x, result);
return 0;
}

函数名: ldexp

功能: 计算value*2的幂

用法: double ldexp(double value, int exp);

程序例:

#include
#include
int main(void)
{
double value;
double x = 2;
/* ldexp raises 2 by a power of 3
then multiplies the result by 2 */
value = ldexp(x,3);
printf("The ldexp value is: %lf\n",
value);
return 0;
}

函数名: ldiv

功能: 两个长整型数相除, 返回商和余数

用法: ldiv_t ldiv(long lnumer, long ldenom);

程序例:

/* ldiv example */
#include
#include
int main(void)
{
ldiv_t lx;
lx = ldiv(100000L, 30000L);
printf("100000 div 30000 = %ld remainder %ld\n", lx.quot, lx.rem);
return 0;
}