当前位置:网站首页>字符编码和浮点型计算精度丢失问题
字符编码和浮点型计算精度丢失问题
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。
即二进制出现无法精确表示的情况,就有可能出现运算结果不精确的情况。
边栏推荐
- Payment module implementation
- PHP三元(三目)运算符
- hboot and recovery, boot.img, system.img
- #yyds干货盘点# 面试必刷TOP101:链表中环的入口结点
- Quick Start Tutorial for flyway
- SQL注入 Less54(限制次数的SQL注入+union注入)
- Learn about C# anonymous methods
- VOT2021 game introduction
- HTC使用官方固件作为底包制作rom卡刷包教程
- Bika LIMS open source LIMS set - use of SENAITE (detection process)
猜你喜欢
UOS - WindTerm use
iNeuOS industrial Internet operating system, equipment operation and maintenance business and "low-code" form development tools
VOT2021 game introduction
ICML2022 | 深入研究置换敏感的图神经网络
In Golang go-redis cluster mode, new connections are constantly created, and the problem of decreased efficiency is solved
[NLP] What is the memory of the model!
Recognize anomalies (you will understand after reading this)
一款国外开发的高质量WordPress下载站模板主题
Collation of knowledge points in Ningbo University NBU IT project management final exam
日常--Kali开启SSH(详细教程)
随机推荐
Shell common scripts: Nexus batch upload local warehouse enhanced version script (strongly recommended)
How to reduce the gap between software design and implementation
Shell常用脚本:Nexus批量上传本地仓库增强版脚本(强烈推荐)
[QNX Hypervisor 2.2用户手册]9.16 system
支付模块实现
[QNX Hypervisor 2.2 User Manual]9.16 system
Golang - from entry to abandonment
[Code Hoof Set Novice Village 600 Questions] Leading to the combination of formulas and programs
Summary of the classic drawing method of histogram
新产品如何进行网络推广?
Input and output optimization
登录业务实现(单点登录+微信扫码+短信服务)
How to debug TestCafe
Daily--Kali opens SSH (detailed tutorial)
标段参数说明
(26) About menu of the top menu of Blender source code analysis
【Acwing】The 62nd Weekly Game Solution
无状态与有状态的区别
SQL注入 Less46(order by后的注入+rand()布尔盲注)
Binary tree non-recursive traversal