当前位置:网站首页>Int type changed to double
Int type changed to double
2022-07-21 02:11:00 【kt1776133839】
Although a small range of types to a large range of types can Implicit conversion , But when there is an expression operation, you need Coercive transformation , Otherwise, accuracy may be lost .
Left to right range From small to large :byte->short->int->long->float->double
for example :
int a = 1;
double b = a/2; // The result is 0
double c = (double)a/2; // The result is 0.5
stay Java Two of them int Divide the numbers of type , Take the whole part , The decimal part is directly rounded off , As above a/2.
If there are two types in the expression , The results are subject to the large type .
for example :
int a = 1;
double b = 2.0; //double Assignment can be written 2, Can also write 2.0, Can also write 2d, perhaps 2.0d
double c = a/b; The result is 0.5 ,// The result is no longer forced
边栏推荐
- Mindspire open source anniversary carnival, quantum machine learning and deep molecular simulation and other huge new features are coming!
- Laravel定时任务
- scala 函数&方法、函数&方法的实现原理
- leetcode 剑指 Offer 32 - III. 从上到下打印二叉树 III
- Project scheduled task
- 【培训课程专用】Trustzone--配置中断的安全属性
- 技术干货 | 解决面试中80%问题,基于MindSpore实现AUC/ROC
- Grouping convolution and deep separable convolution
- leetcode 剑指 Offer 26. 树的子结构
- MySQL metabase & Account Management & Engine
猜你喜欢
scala 函数&方法、函数&方法的实现原理
响应式织梦模板锁具锁芯类网站
Win: use Netsh command to configure port forwarding
分享一个好玩的JS小游戏
【已解决】org.apache.catalina.LifecycleException: 无法启动组件[StandardEngine[Catalina].StandardHost[localhost]
JASMINER X4 became popular overseas and was praised by many well-known bloggers
重新定义分析 - EventBridge 实时事件分析平台发布
(pc+wap) Zhimeng template accounting service website
Clé
Fruit loops studio music host software Daw fruit software 20.9 Chinese version
随机推荐
DenseNet学习笔记(核心与resnet进行对比):
What parameters do you need to see when buying a server and how to see the server configuration
简略break、continue、return的区别
【培训课程专用】启动-异常学习笔记-代码导读
【upload靶场12-16】截断、图片马
波场联合储备发表公开信,强调USDD不受制于任何中心化机构
Doris Connector 结合 Flink CDC 实现 MySQL 分库分表 Exactly Once精准接入
如何选择数据应用开发语言和环境
(PC+WAP)织梦模板会计服务类网站
技术干货 | 解决面试中80%问题,基于MindSpore实现AUC/ROC
【培训课程专用】Trustzone--TZC400设置安全内存
【upload靶场1-11】基础关卡:特点、分析、利用
【Pygame 学习笔记】8.精灵
正则表达式教程笔记
DP背包问题
C语言实现并查集
Daily question 1: numbers that appear more than half of the time in the array (Sword finger offer39)
leetcode 剑指 Offer 32 - III. 从上到下打印二叉树 III
Merge and sort targeted questions
scala 函数&方法、函数&方法的实现原理