• If either operand is of type long double, the other operand is converted to type long double.

    • If the above condition is not met and either operand is of type double, the other operand is converted to type double.

    • If the above two conditions are not met and either operand is of type float, the other operand is converted to type float.

//如果不是浮点数精度

    1. If the above three conditions are not met (none of the operands are of floating types), then integral conversions are performed on the operands as follows:

      • If either operand is of type unsigned long, the other operand is converted to type unsigned long.

      • If the above condition is not met and either operand is of type long and the other of type unsigned int, both operands are converted to type unsigned long.

      • If the above two conditions are not met, and either operand is of type long, the other operand is converted to type long.

      • If the above three conditions are not met, and either operand is of type unsigned int, the other operand is converted to type unsigned int.

      • If none of the above conditions are met, both operands are converted to type int.

        • 二元运算不考虑枚举的话,如果两边类型不一样,且有一边是浮点类型,则两边都转换成等级更高的浮点类型。否则两边进行integral promotion,然后如果两边类型不一样且同是signed或者同是unsigned,等级低的类型转换成等级高的类型。否则如果unsigned一边等级高于或等于signed一边,signed那边转换成unsigned那边的类型。否则如果signed那边的类型能容纳unsigned那边的范围,unsigned那边转换成signed那边的类型。否则两边都转换成signed那边对应的unsigned类型。

c/c++基本数据类型转换的更多相关文章

  1. 关于Java中的基本数据类型转换

    Java中的基本类型有四种,其中整型分为byte.short.int.long,浮点型分为float.double,字符型char,布尔型boolean.8种类型的级别由低到高byte->sho ...

  2. java变量的作用域和基本数据类型转换

    1.变量的作用域 赋值运算符 变量名 = 表达式 列: a = (b+3)+(b-1) 表达式就是符号(如:加号,减号)与操作数(如:b,3)的组合 自动类型转换(隐式类型转换):从小类型到大类型可以 ...

  3. 彻底理解Java中的基本数据类型转换(自动、强制、提升)

    说基本数据类型转换之前,先了解下 Java 中的 8 种基本数据类型,以及它们的占内存的容量大小和表示的范围,如下图所示. 重新温故了下原始数据类型,现在来解释下它们之间的转换关系. 自动类型转换 自 ...

  4. javascript 六种基本数据类型转换

    javascript 六种基本数据类型转换 1.显式转换 通过手动进行类型转换,Javascript提供了以下转型函数: 转换为数值类型:Number(mix).parseInt(string,rad ...

  5. Java基本数据类型转换及运算符

    上次我们说到完了Java中的基本数据类型,今天我们来说说Java中的基本数据类型转换和Java中的运算符 基本数据类型转换 java中可以从任意基本数据类型转型到外的基本数据类型 注意:(boolea ...

  6. JavaSE基础(十)--Java中的基本数据类型转换

    Java中的基本数据类型转换 说基本数据类型转换之前,先了解下 Java 中的 8 种基本数据类型,以及它们的占内存的容量大小和表示的范围,如下图所示. 重新温故了下原始数据类型,现在来解释下它们之间 ...

  7. Java基本数据类型转换

    一:Java的基本数据类型和引用数据类型 1:基本数据类型 2:引用数据类型 二:基本数据的类型转换 基本数据类型中,布尔类型boolean占有一个字节,由于其本身所代码的特殊含义,boolean类型 ...

  8. java基本数据类型转换成byte[]数组

    import java.io.UnsupportedEncodingException;  public class ConToByte {      /**     * double转换byte   ...

  9. JAVA基本数据类型转换的注意事项

    JAVA中基本数据类型: 类型: 字节: 范围: 默认值: byte 1 -128~127 0 short 2 -32768~32767 0 char 2 0~65535 '\u0000' int 4 ...

随机推荐

  1. 从汉诺塔游戏理解python递归函数

    汉诺塔游戏规则: 有三根相邻的柱子,标号为A,B,C,A柱子上从下到上按金字塔状叠放着n个不同大小的圆盘,现在把所有盘子一个一个移动到柱子B上,并且每次移动同一根柱子上都不能出现大盘子在小盘子上方 图 ...

  2. C# Js 时间格式化问题

    C# 后台: .ToString("dd-MMM-yyyy", System.Globalization. DateTimeFormatInfo.InvariantInfo) eg ...

  3. Windows下Visual Studio2017之AI环境搭建

    本博客主要包含以下3点: AI简介及本博客主要目的 环境介绍及安装原因 搭建环境及检验是否安装成功 离线模型的训练 时间分配:   时间 时长(分钟) 收集资料+写博客 6.12 11:28-12:2 ...

  4. Team Member Introduction and Division of Work

    Team leader Name:宋天舒 Student Number:12061166 Interested In: Information safety. Responsible For: Des ...

  5. 团队计划backlog---DayTwo

    任务索引卡(Two): 1.  季方:实现界面跳转,数据库相关数据的显示 的测试: 2.  司宇航:添加部分团队博客,并测试: 3.  王金萱.马佳慧:学习爬虫的相关内容,为将来统计博客部分做准备: ...

  6. Beta Scrum Day 4 — 听说

    听说

  7. Alpha版本冲刺(八)

    目录 组员情况 组员1(组长):胡绪佩 组员2:胡青元 组员3:庄卉 组员4:家灿 组员5:凯琳 组员6:翟丹丹 组员7:何家伟 组员8:政演 组员9:黄鸿杰 组员10:刘一好 组员11:何宇恒 展示 ...

  8. JAVA自学日记——Part Ⅰ.

    和C++比较相似,Java同样是面向对象的设计语言,在基础的语句上有一些不大的差别,经过两天的学习,大概的了解了在eclipse中如何进行简单的编程,解决一些简单的问题,诸如在学习C时做过的“字符串倒 ...

  9. Java基本程序设计结构

    一.要求: 1.设平面上有一个m×n 的网格,将左下角的网格点标记为(0,0)而右上角的网格点标记为(m,n).某人想从(0,0)出发沿网格线行进到达(m,n),但是在网格点(i,j)处他只能向上行进 ...

  10. excel表格如何限制单元格输入内容

    一天一天实在太快,周六了~~~ 测试任务不太紧的时候就可以着手开始整理本月的测试项目,选择的是excel,清晰明了. 原来excel的功能远比我们想象的强大与好用,今天先介绍如何限制单元格内容: 如下 ...