十进制数转换为十六进制数_十进制数制到十六进制数制的转换

十进制数转换为十六进制数

Conversion of decimal number system into hexadecimal number system can be done by successively dividing an integral part by 16 till the quotient is 0 and then reading the remainder of all in the bottom to the top manner, where the bottom one is the MSB and the topmost is the LSB. For fractional part, we successively multiply it by 16 till we get 0 in the fractional part of the product term, the integral part of the product term recorded from top to bottom forms the respective hexadecimal number where topmost is the MSB.

可以通过将一个整数部分依次除以16直到商为0,然后从下到上依次读取所有的余数,从而将十进制数系统转换为十六进制系统 ,其中最低的是MSB,最高的是是LSB。 对于小数部分,我们将其连续乘以16,直到乘积项的小数部分得到0,从上到下记录的乘积项的整数部分形成相应的十六进制数,其中最高的是MSB。

To convert a mixed decimal number into hexadecimal, we will first convert integral and fractional parts into hexadecimal and then combine them.

要将混合的十进制数转换为十六进制 ,我们将首先将整数和小数部分转换为十六进制,然后将它们组合。

The only thing to be kept in mind is the digits in hexadecimal number system are as:

唯一要记住的是十六进制数字中的数字为:

1 , 2, 3, 4, 5, 6, 7, 8, 9, 10 = A, 11 = B, 12 = C, 13 = D, 14 = E, 15 = F

1、2、3、4、5、6、7、8、9、10 = A,11 = B,12 = C,13 = D,14 = E,15 = F

Now let's take examples to understand the conversion of decimal number to hexadecimal number.

现在,让我们以示例了解十进制数到十六进制数转换

Example 1:

范例1:

Convert (1954.785)10 to ( ? )16

将(1954.785) 10转换为(?) 16

Solution:

解:

Given decimal number (1954.785)10 is of mixed type and contains both integral (1954)10 and decimal part (0.785)10. To convert the given number into hexadecimal, we have to convert integral and fractional part individually into hexadecimal and then combine them together to get the required result.

给定的十进制数(1954.785) 10是混合类型,并且包含整数(1954) 10和十进制部分(0.785) 10 。 要将给定数字转换为十六进制,我们必须将整数和小数部分分别转换为十六进制,然后将它们组合在一起以获得所需的结果。

Integral Part

整体部分

DivisorQuotientRemainder
161954
161222 LSB
16710 = A
1607 MSB
除数
16 1954年
16 122 2 LSB
16 7 10 = A
16 0 7个MSB

The remainders read from bottom to top gives the equivalent hexadecimal number i.e., (1954)10 = (7A2)16.

从下到上读取的余数给出等效的十六进制数,即(1954) 10 =(7A2) 16

Fractional Part

小数部分

    0.785 * 16 = 12.56 = C.56     (MSB)
0.56 * 16 = 8.96
0.96 * 16 = 15.36 = F.36
0.36 * 16 = 5.76
0.76 * 16 = 12.16 = C.16    (LSB)

The integer part of the product term read from top to bottom forms the equivalent hexadecimal number i.e., (0.785)10 = (0.C8F5C)16.

从上到下读取的乘积项的整数部分形成等效的十六进制数,即(0.785) 10 =(0.C8F5C) 16

After converting both integral part and fractional part individually into hexadecimal, now we combine both to get our desired result i.e., (1954.785)10 = (7A2.C8F5C)16.

将整数部分和小数部分分别转换为十六进制后,现在我们将两者结合起来即可得到所需的结果,即(1954.785) 10 =(7A2.C8F5C) 16

Example 2:

范例2:

Convert (3283.715)10 to ( ? )16

将(3283.715) 10转换为(?) 16

Solution:

解:

Integral Part

整体部分

DivisorQuotientRemainder
163283
162053 LSB
161213=D
16012=C MSB
除数
16 3283
16 205 3 LSB
16 12 13 = D
16 0 12 = C高位

The remainders read from bottom to top gives the equivalent hexadecimal number i.e., (3283)10 = (CD3)16.

从下到上读取的余数给出等效的十六进制数,即(3283) 10 =(CD3) 16

Fractional Part

小数部分

    0.715 * 16 = 11.44 = B.44   (MSB)
0.44 * 16 = 7.04
0.04 * 16 = 0.64
0.64 * 16 = 10.24 = A.24    (LSB)

The integer part of the product term read from top to bottom forms the equivalent hexadecimal number i.e., (0.715)10 = (0. B70A)16.

从上到下读取的乘积项的整数部分形成等效的十六进制数,即(0.715) 10 =(0. B70A) 16

After converting both integral part and fractional part individually into hexadecimal, now we combine both to get our desired result i.e., (3283.715)10 = (CD3. B70A)16.

在将整数部分和小数部分分别转换为十六进制之后,现在我们将两者合并以获得所需的结果,即(3283.715) 10 =(CD3。B70A) 16

Example 3:

范例3:

Convert (356.225)10 to ( ? )16

将(356.225) 10转换为(?) 16

Solution:

解:

Integral Part

整体部分

DivisorQuotientRemainder
16356
16224 LSB
1616
1601 MSB
除数
16 356
16 22 4 LSB
16 1个 6
16 0 1个MSB

The remainders read from bottom to top gives the equivalent hexadecimal number i.e., (356)10 = (164)16.

从下到上读取的余数给出等效的十六进制数,即(356) 10 =(164) 16

Fractional Part

小数部分

    0.225 * 16 = 3.600		(MSB)
0.600 * 16 = 9.600
0.600 * 16 = 9.600
0.600 * 16 = 9.600		(LSB)

The integer part of the product term read from top to bottom forms the equivalent hexadecimal number i.e., (0.225)10 = (0.39)16.

从上到下读取的乘积项的整数部分形成等效的十六进制数,即(0.225) 10 =(0.3 9 ) 16

After converting both integral part and fractional part individually into hexadecimal, now we combine both to get our desired result i.e., (356.225)10 = (164.39)16.

在将整数部分和小数部分分别转换为十六进制之后,现在我们将两者结合以获得所需的结果,即(356.225) 10 =(164.3 9 ) 16

翻译自: https://www.includehelp.com/basics/conversion-of-decimal-number-system-into-hexadecimal-number-system.aspx

十进制数转换为十六进制数

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/546064.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

编译器开发相关资源

开发编译器相关的一些网络资源: how difficult is it to write a compiler? wikipedia compiler compiler 101 code competetion pl/0 (couses ,source code ,another source code )and pl/I language the gentle compiler construction sys…

计算机二级考试C++考试大纲

基本要求: 1. 掌握C语言的基本语法规则。 2. 熟练掌握有关类与对象的相关知识。 3. 能够阅读和分析C程序。 4. 能够采用面向对象的编程思路和方法编写应用程序。 5. 能熟练使用Visual C6.0集成开发环境编写和调度程序。 考试内容: 一、 C语言概述 1. 了解C语言的基本…

自动化运维工具Saltstack详细介绍

Saltstack是一个新的基础设施管理工具。目前处于快速发展阶段,可以看做是pssh弱化的Puppet的组合。间接的反映出了saltstack的两大功能:远程执行和配置管理。Saltstack使用Python开发,是一个非常简单易用和轻量级的管理工具。由Master和Minio…

为什么建议你使用枚举?

枚举是 JDK 1.5 新增的数据类型,使用枚举我们可以很好的描述一些特定的业务场景,比如一年中的春、夏、秋、冬,还有每周的周一到周天,还有各种颜色,以及可以用它来描述一些状态信息,比如错误码等。枚举类型不…

数据结构树二叉树计算节点_查找二叉树中叶节点的数量 数据结构

数据结构树二叉树计算节点Algorithm: 算法: One of the popular traversal techniques to solve this kind of problems is level order tree traversal (Read: Level Order Traversal on a Binary Tree) where we use the concept of BFS. 解决此类问题的一种流行…

重磅!阿里推出国产开源JDK!

简介Alibaba Dragonwell 是一款免费的, 生产就绪型Open JDK 发行版,提供长期支持,包括性能增强和安全修复。阿里巴巴拥有最丰富的Java应用场景,覆盖电商,金融,物流等众多领域,世界上最大的Java用户之一。Al…

部分排序算法c语言实现

代码比较粗糙,主要是用于对排序算法的理解,因而忽略了边界和容错处理相关代码。 相关文档: Insert Sort ,Bubble Sort ,Select Sort ,Shell sort ,Quick sort ,Heap sort ,Merge sort on Wikipedia algorithm Repository :C语言实现部分排…

计算机等级考试二级ACCESS考试大纲

公共基础知识部分30分 专业语言部分 70分 基本要求 1. 具有数据库系统的基础知识。 2. 基本了解面各对象的概念。 3. 掌握关系数据库的基本原理。 4. 掌握数据库程序设计方法。 5. 能使用Access建立一个小型数据库应用系统。 考试内容 一、 数据库基础知识 1. 基本概念&#xf…

C语言 常用单词

main 主要的 printf(print format)格式输出 include , return ,if ,else ,switch ,case 机箱;案例; default 默认 ,for while break 暂停;间断; continue math int char 字符; …

ipv6寻址_有类和无类寻址:IPV4寻址| 计算机网络

ipv6寻址1)分类寻址 (1) Classful Addressing) IPv4 addressing used the concept of classes. This architecture is known as classful addressing. IPv4寻址使用类的概念。 这种体系结构称为类寻址 。 In the classful addressing, there are 5 classes in which the addre…

windows没有软盘 怎么解决

1这种情况我遇到过。 现象为:启动快到桌面之前,会出现红叉错误提示框,标题为“Windows-没有软盘”,内容为“驱动器中没有软盘。请在\Device\Harddisk1\DR5 中插入软盘”,有“取消”、“重试”、“继续”三个按钮。点“…

forth编程语言

forth 是一种基于栈的程序设计语言,其语法使用逆波兰表达式(即后缀表达式),forth的黄金期是上世纪80年代,现在使用的人很少,但是却非常的有趣。还有一个以forth为基础开发的语言factor ,它增加了许多当代的…

安装TPCC-MySQL报错

2019独角兽企业重金招聘Python工程师标准>>> 安装TPCC-MySQL做压力测试,由于TPCC-MySQL是bzr工具进行版本控制的,所以要先安装bzr [rootmha_backup /root] #rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.r…

enumerate_Java Thread类的static int enumerate(Thread [] th)方法与示例

enumerate线程类static int枚举(Thread [] th) (Thread Class static int enumerate(Thread[] th)) This method is available in package java.lang.Thread.enumerate(Thread[] th). 软件包java.lang.Thread.enumerate(Thread [] th)中提供了此方法。 This method is used to …

自由职业的前半年,我是如何度过的?

生活中所受的苦,终会以一种形式回归。我是一个后知后觉的人,从 2009 年毕业到现在,已经有 11 年的光景了,参加工作的前几年我从没想过要快速的提升自己的技能,对待工作也没有全力以赴,这样的迷茫和随大流的…

Microsoft Visual C++ Runtime Library 错误解决办法

今天安装软件时,出现“Microsoft Visual C Runtime Library”错误,网上查了下解决方法,得以解决。现在分享下,给碰到相同问题的朋友。微软官方解释如下:症状在 Microsoft Windows XP 中运行自定义 Microsoft Visual C …

Eucalyptus常用查询命令

前言: Elastic Utility Computing Architecture for Linking Your Programs To Useful Systems (Eucalyptus) 是一种开源的软件基础结构,用来通过计算集群或工作站群实现弹性的、实用的云计算。它最初是美国加利福尼亚大学 Santa …

the blocks problem(uva 101 or poj 1208)

题目描述见:uva 101 or poj 1208 关键在于彻底理解题目中搬积木的几个命令的含义,见具体分析 如果还不能理解题意,那么找一个正确通过的代码,编译并输入测试数据,查看其每一个命令的执行情况。如我的代码中162行注…

调整灰度图像的大小,而无需在Python中使用任何内置函数

In this program, we will be using two functions of OpenCV-python (cv2) module. Lets see their syntax and descriptions first. 在此程序中,我们将使用OpenCV-python(cv2)模块的两个功能。 首先让我们看看它们的语法和说明。 1) imread():It takes an absolu…

第一章 认识计算机

*(%)^*&!*第一讲 了解计算机基础知识一、计算机的发展历程1、计算机的起源(1)世界上第一台计算机:1946年诞生,名称为ENIAC。(2)世界上第一台并行计算机:1950年诞生,名称为EDVAC&…