Chinaunix首页 | 论坛 | 博客
  • 博客访问: 392372
  • 博文数量: 103
  • 博客积分: 3073
  • 博客等级: 中校
  • 技术积分: 1078
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-23 15:04
文章分类

全部博文(103)

文章存档

2012年(13)

2011年(76)

2010年(14)

分类: LINUX

2011-07-14 10:18:33

Arithmetic Conversions

The conversions depend on the specific operator and the type of the operand or operands. However, many operators perform similar conversions on operands of integer and floating-point types. These standard conversions are known as the arithmetic conversions because they apply to the types of values ordinarily used in arithmetic.

Arithmetic conversions are used for matching operands of arithmetic operators.

Arithmetic conversion proceeds in the following order:

Operand Type Conversion
One operand has long double type The other operand is converted to long double.
One operand has double type The other operand is converted to double.
One operand has float type The other operand is converted to float.
One operand has unsigned long long int type The other operand is converted to unsigned long long int
One operand has long long type. The other operand is converted to long long.
One operand has unsigned long int type The other operand is converted to unsigned long int.
One operand has unsigned int type and the other operand has long int type and the value of the unsigned int can be represented in a long int The operand with unsigned int type is converted to long int.
One operand has unsigned int type and the other operand has long int type and the value of the unsigned int cannot be represented in a long int Both operands are converted to unsigned long int.
One operand has long int type The other operand is converted to long int.
One operand has unsigned int type The other operand is converted to unsigned int.
Both operands have int type The result is type int.
阅读(439) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~