当前位置:网站首页>字符编码和浮点型计算精度丢失问题
字符编码和浮点型计算精度丢失问题
2022-07-31 22:44:00 【周周 嘿嘿】
一.字符编码
字符在计算机内存中是以unicode字符集进行编码,即字符占两个字节。
unicode包括中文,韩语等字符,之所以取代ascll编码集是因为其字符集只包括大小写英文字符,数字等字符,不包括中文,韩语等字符,unicode是国际统一使用的字符集。
字符在文件和网络传输中很多情况以UTF-8编码进行存储和传输,这样可以节省空间和传输效率
unicode和utf-8在文件输入输出和网络传输中自动转换。
window操作系统默认编码是gbk编码,例如:运行java文件,需要用javac -encoding utf-8命令进行编译,否则运行会出现乱码,java文件是utf-8编码,所以编译命令需要使用utf-8进行解析,否则就会出错
注意:用什么编码存储的文件,就得用该编码进行解析,上述就是很好的例子。
二.精度丢失问题
在java和python中,浮点数十进制转换为二进制可能出现二进制无法精确表示的情况,此时就会出现运算结果不精确的情况,例如println(0.1+0.2),结果是0.3000000004。
即二进制出现无法精确表示的情况,就有可能出现运算结果不精确的情况。
边栏推荐
- #yyds dry goods inventory# Interview must brush TOP101: the entry node of the ring in the linked list
- IDA PRO中汇编结构体识别
- 如何导入 Golang 外部包并使用它?
- SQL27 View user details of different age groups
- 基于mysql的消息队列设计
- VOT2021比赛简介
- 如何减少软件设计和实现之间鸿沟
- Student management system on the first day: complete login PyQt5 + MySQL5.8 exit the operation logic
- Shell常用脚本:Nexus批量上传本地仓库脚本
- [Code Hoof Set Novice Village 600 Questions] Leading to the combination of formulas and programs
猜你喜欢

Flex layout in detail

The difference between adding or not adding the ref keyword when a variable of reference type is used as a parameter in a method call in C#

ICML2022 | 深入研究置换敏感的图神经网络

MLP神经网络,GRNN神经网络,SVM神经网络以及深度学习神经网络对比识别人体健康非健康数据

UOS - WindTerm use

UOS统信系统 - WindTerm使用

网易云信圈组上线实时互动频道,「破冰」弱关系社交

数据分析(一)——matplotlib

Document management and tools in the development process

景区手绘地图的绘制流程
随机推荐
Student management system on the first day: complete login PyQt5 + MySQL5.8 exit the operation logic
Interview assault 69: TCP reliable?Why is that?
(26) About menu of the top menu of Blender source code analysis
Dry goods | 10 tips for MySQL add, delete, change query performance optimization
The difference between adding or not adding the ref keyword when a variable of reference type is used as a parameter in a method call in C#
Bika LIMS open source LIMS set - use of SENAITE (detection process)
Shell common script: Nexus batch upload local warehouse script
Judging decimal points and rounding of decimal operations in Golang
不知道该怎么办的同步问题
[QNX Hypervisor 2.2 User Manual]9.14 set
The difference between adding or not adding the ref keyword when a variable of reference type is used as a parameter in a method call in C#
JS basic exercises
基于RT1052 Aworks nanopb string 类型固定长度使用方式(二十七)
Flutter教程之四年开发经验的高手给的建议
Audio alignment using cross-correlation
日常--Kali开启SSH(详细教程)
[Code Hoof Set Novice Village 600 Questions] Leading to the combination of formulas and programs
hboot and recovery, boot.img, system.img
Shell常用脚本:Nexus批量上传本地仓库脚本
新产品如何进行网络推广?