Binary to Decimal Conversion in Limited Precision

hostapd.conf配置文档 ##### hostapd configuration file ############################################## # Empty lines and lines starting with # are ignored # AP netdevice name (without 'ap' postfix, i.e., wlan0 uses wl 阅读详情

 

Binary to Decimal Conversion in Limited Precision

Part of the Arithmetic Tutorial Collection
by Douglas W. Jones
THE UNIVERSITY OF IOWA Department of Computer Science

Copyright © 1999, Douglas. W. Jones, with major revisions mad e in 2002 and a small update in 2007. This work may be transmitted or stored in electronic form on any computer attached to the Internet or World Wide Web so long as this notice is included in the copy. Individuals may make single copies for their own use. All other rights are reserved.

Index

Rated as a top 50 site by Programmer's Heaven as of Feb 2002.

Introduction

Programmers on binary computers have always faced computational problems when dealing with textual input-output because of our convention that printed numeric data should be represented in base 10. These problems have never been insurmountable, but they are particularly annoying when writing programs for machines with limited capacity in their arithmetic units. Suppose, for example, you have an unsigned binary number that you wish to print out in decimal form. The following C code will do this:

    void putdec( unsigned int n )
{
unsigned int rem = n % 10;
unsigned int quot = n / 10;
if (quot > 0) putdec( quot );
putchar( rem + '0' );
}

The problem with this C code is that it assumes that the computer's arithmetic unit is sufficiently large to handle the entire number n, and it assumes that the arithmetic unit can conveniently do integer division yielding both a quotient and a remainder. These assumptions are not always reasonable, both because many commercially successful computers do not include division hardware and because, even when such hardware is available, it is of little direct use when dividing numbers larger than the ALU can handle.

The focus of this tutorial is on writing fast code to convert unsigned 16 bit binary numbers to decimal on a machine with an 8-bit ALU and no divide instruction. This situation is common on small microcontrollers, and the techniques generalize in useful ways, for example, to the problem of doing 64 bit binary to decimal conversion using a 32 bit ALU.

On machines with no divide instruction where speed is no issue, it may be better to simply use repeated subtraction instead of the fast but algebraically complex code given in the body of this tutorial. Consider the following 16-bit conversion code as an example:

    void putdec( int n )
{
char a, b, c, d;
if (n < 0) {
putchar( '-' );
n = -n;
}
for ( a = '0' - 1; n >= 0; n -= 10000 ) ++a;
for ( b = '9' + 1; n < 0; n += 1000 ) --b;
for ( c = '0' - 1; n >= 0; n -= 100 ) ++c;
for ( d = '9' + 1; n < 0; n += 10 ) --d;
putchar( a );
putchar( b );
putchar( c );
putchar( d );
putchar( n + '0' );
}

Variants on the clever algorithm given above have been very popular on 8-bit microprocessors and microcontrollers, despite the fact that conversions can require over 30 iterations of the for loops in this code.

 


The Basic Idea

To do the conversion faster, what we'll do is look at our binary number as a base 16 number and then do the conversion in terms of the base 16 digits. Consider a 16 bit number n . This can be broken into 4 fields of 4 bits each, the base 16 digits; call them n 3 , n 2 , n 1 and n 0 .

                    n
|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|
|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|
| n | n | n | n |
3 2 1 0

The value of the number can be expressed in terms of these 4 fields as follows:

n = 4096n 3 + 256n 2 + 16n 1 + n 0

In the same way, if the value of n , expressed in decimal, is d 4 d 3 d 2 d 1 d 0 , where each of d 4 , d 3 , d 2 , d 1 and d 0 are decimal digits, the value of n can be expressed as:

n = 10000d 4 + 1000d 3 + 100d 2 + 10d 1 + d 0

Our problem then, is to compute the d i from the n i without dealing directly with the larger number n .

To do this, we first note that the factors used in combining the values of n i can themselves be expressed as sums of multiples of powers of 10. Therefore, we can rewrite the original expression as:

n =
n 3 ( 4×1000 + 0×100 + 9×10 + 6×1 ) +
n 2 ( 2×100 + 5×10 + 6×1 ) +
n 1 ( 1×10 + 6×1 ) +
n 0 ( 1×1 )

If distribute the n i over the expressions for each factor, then factor out the multiples of 100, we get the following:

n =
1000(4n 3 ) +
100(0n 3 + 2n 2 ) +
10(9n 3 + 5n 2 + 1n 1 ) +
1(6n 3 + 6n 2 + 6n 1 + 1n 0 )

We can use this to arrive at first approximations a i for d 3 through d 0 :

a 3 = 4n 3
a 2 = 0n 3 + 2n 2
a 1 = 9n 3 + 5n 2 + 1n 1
a 0 = 6n 3 + 6n 2 + 6n 1 + 1n 0

The values of a i are not proper decimal digits because they are not properly bounded in the range 0 < a i < 9. Instead, given that each of n i is bounded in the range 0 < n i < 15, the a i are bounded as follows:

0 < a 3 < 60
0 < a 2 < 30
0 < a 1 < 225
0 < a 0 < 285

This is actually quite promising because a 3 through a 1 are less than 256 and may therefore be computed using an 8 bit ALU, and even a 0 may be computed in 8 bits if we can use the carry-out bit of the ALU to hold the high bit. Furthermore, if our interest is 2's complement arithmetic where the high bit is the sign bit, the first step in the output process is to print a minus sign and then negate, so the constraint on n 3 becomes 0 < n 3 < 8 and we can conclude naively that

0 < a 0 < 243

Note that we said n 3 < 8 and not n 3 < 8; this is because of the one negative number in the 2's complement system that cannot be properly negated, -32768. If we exclude this number from the range of legal values, the upper bound is reduced to 237; in fact, this is the overall upper bound, because in the one case where n 3 is 8, all of the other n i are zero, so we can assert globally that

0 < a 0 < 237

Even with our naive bound, however, it is easy to see that we can safely use 8 bit arithmetic to accumulate all of the a i .

Given that we have computed the a i , we can push them into the correct ranges by a series of 8-bit divisions and one 9-bit division, as follows:

c 1 = a 0 / 10
d 0 = a 0 mod 10

c 2 = (a 1 + c 1 ) / 10
d 1 = (a 1 + c 1 ) mod 10

c 3 = (a 2 + c 2 ) / 10
d 2 = (a 2 + c 2 ) mod 10

c 4 = (a 3 + c 3 ) / 10
d 3 = (a 3 + c 3 ) mod 10

d 4 = c 4

In the above, the c i terms represent carries propagated from one digit position to the next. The upper bounds on each of the c i can be computed from the bounds given above for the a i :

c 1 < 28 [ = 285/10 ]
c 2 < 25 [ = (28 + 225)/10 = 253/10 ]
c 3 < 5 [ = (25 + 30)/10 = 55/10 ]
c 4 < 6 [ = (5 + 60)/10 = 65/10 ]

In computing the bound on c 2 , we came within 2 of to 255, the maximum that can be represented in 8 bits, so an 8 bit ALU is just barely sufficient for this computation. Again, if we negate any negative numbers prior to output, so that the maximum value of n 3 is 8, the bound on c 1 becomes 23 instead of 28.

 


Reduction to Code

A first hack at reducing the above idea to code might include named temporaries for all of the terms used above, but we can avoid this if we reorganize things slightly and note that, after computing each digit of the number, we no-longer need one of the n i . This leads to the following C code, assuming that C allocates 16 bits to items of type short int and 8 bits to items of type char :

    void putdec( unsigned short int n )
{
unsigned char d4, d3, d2, d1, q;
unsigned short int d0;

d0 = n & 0xF;
d1 = (n>>4) & 0xF;
d2 = (n>>8) & 0xF;
d3 = (n>>12) & 0xF;

d0 = 6*(d3 + d2 + d1) + d0;
q = d0 / 10;
d0 = d0 % 10;

d1 = q + 9*d3 + 5*d2 + d1;
q = d1 / 10;
d1 = d1 % 10;

d2 = q + 2*d2;
q = d2 / 10;
d2 = d2 % 10;

d3 = q + 4*d3;
q = d3 / 10;
d3 = d3 % 10;

d4 = q;

putchar( d4 + '0' );
putchar( d3 + '0' );
putchar( d2 + '0' );
putchar( d1 + '0' );
putchar( d0 + '0' );
}

Of course, the above code prints all 5 digits of n instead of only printing the significant digits, but this can be fixed in many ways. The following fix is perhaps the cleanest, making effective use of partial results as soon as those results can be used to predict that digits will be zero. Even so, adding these features to the code obscures the computation being performed.

    void putdec( unsigned short int n )
{
unsigned char d4, d3, d2, d1, q;
unsigned short int d0;

d0 = n & 0xF;
d1 = (n>>4) & 0xF;
d2 = (n>>8) & 0xF;
d3 = (n>>12);

d0 = 6*(d3 + d2 + d1) + d0;
q = d0 / 10;
d0 = d0 % 10;

d1 = q + 9*d3 + 5*d2 + d1;
if (d1 != 0) {
q = d1 / 10;
d1 = d1 % 10;

d2 = q + 2*d2;
if ((d2 != 0) || (d3 != 0)) {
q = d2 / 10;
d2 = d2 % 10;

d3 = q + 4*d3;
if (d3 != 0) {
q = d3 / 10;
d3 = d3 % 10;

d4 = q;

if (d4 != 0) {
putchar( d4 + '0' );
}
putchar( d3 + '0' );
}
putchar( d2 + '0' );
}
putchar( d1 + '0' );
}
putchar( d0 + '0' );
}

Dealing with Signed Numbers

To print signed values, we can replace the first few lines of the above code with the following:

    void putdec( int n )
{
unsigned char d4, d3, d2, d1, d0, q;

if (n < 0) {
putchar( '-' );
n = -n;
}

d0 = n & 0xF;
d1 = (n>>4) & 0xF;
d2 = (n>>8) & 0xF;
d3 = (n>>12) & 0xF;

/* the remainder of the code is unchanged */

As mentioned earlier, forcing n positive prior to breaking it down into nibbles allows us to use a char type for d0 instead of a short int type.

Note that the computation of d3 has also changed as a result of the change from unsigned to signed arithmetic. This is because the right-shift operator shifts zeros into the high bit when applied to unsigned numbers, but it replicates the sign bit when applied to signed numbers. There is one case in 16 bit 2's complement arithmetic where both n and -n are negative, that is, n = -32768. The change we have made gives us the correct output in this case.

 


Living Within 8 Bits

In the code given above for unsigned printing, the fact that a 0 could be as large as 285 forced us to declare the variable d0 as short int instead of char . We can avoid this by observing that the final addition in the sum used to compute a 0 is the only one that will push this sum over 255, and therefore, we need only check the carry bit once to detect overflow. Having detected overflow, we can account for it in the computation that follows:

    void putdec( unsigned short int n )
{
unsigned char d4, d3, d2, d1, d0, q;

d0 = n & 0xF;
d1 = (n>>4) & 0xF;
d2 = (n>>8) & 0xF;
d3 = (n>>12) & 0xF;

if ( (6*(d3 + d2 + d1) + d0) > 255 ) { /* overflow */
d0 = (6*(d3 + d2 + d1) + d0) & 0xFF;
q = d0/10 + 25;
d0 = d0 % 10 + 6;
if (d0 >= 10) {
d0 = d0 - 10;
q = q + 1;
}
} else { /* no overflow */
d0 = 6*(d3 + d2 + d1) + d0;
q = d0 / 10;
d0 = d0 % 10;
}

In the above code, after having noted an overflow in the computation of a 0 , we retain the least significant bits of the sum in d0 and then approximately correct the quotient by adding 256/10, or 25; correcting this and computing the correct remainder is a bit more interesting.

Given some integer i > 256, if we want to compute i mod 10 from (i - 256) mod 10, we need to note that the modulus operator is distributive in an interesting sense:

(i + j ) mod m = ((i mod m ) + (j mod m )) mod m

Using this, we can conclude that:

i mod 10 = (((i - 256) mod 10) + (256 mod 10)) mod 10
= (((i - 256) mod 10) + 6) mod 10

In the case where ((i - 256) mod 10) + 6 is greater than 10, the truncation of the quotient was also incorrect, so we must add 1 to the approximate quotient as well. This justifies the code given above, and this code has also been tested exhaustively for all integers from 0 to 65535.

 


Doing Without Hardware Multiply and Divide

If flat-out speed is not of the essence, the easiest way to do the required divisions is to use the trivial repeated subtraction algorithm. The largest dividend we must consider is only 285, so it will take no more than 28 iterations for this division.

    /* quotient and remainder returned by div10 */
unsigned char q, r;

void div10( unsigned char i )
{
q = 0;
r = i;
while (r > 9) {
q = q + 1;
r = r - 10;
}
}

This can be optimized in several ways. Most notably, termination conditions that compare with zero are almost always significantly faster than those that compare with other constants, so we might write something like this:

    /* quotient and remainder returned by div10 */
unsigned char q, r;

void div10( unsigned char i )
{
q = -1;
r = i;
do {
q = q + 1;
r = r - 10;
} while (r >= 0);
r = r + 10;
}

Another section of this tutorial covers the problem of doing multiplicaton and division using only shift and add instructions. We use the results presented there, taking specific advantage of the limited ranges of values occupied by our dividends, to completely eliminate iteration from our code.

There are two ways to get an exact quotient and remainder from i /10 using reciprocal multiplication in 8 bits. Either we multiply by 0.00011001 to get an approximate quotient and then compute the remainder and correct the quotient, or we multiply by 0.00011001101 to get an exact quotient from which we can compute the remainder.

The former method, yielding an approximation, can be reduced to the following C code:

    /* quotient and remainder returned by div10 */
unsigned char q, r;

void div10( unsigned char i )
{
/* approximate the quotient as q = i*0.000110011 (binary) */
q = ((i>>1) + i) >> 1; /* times 0.11 */
q = ((q>>4) + q) >> 3; /* times 0.000110011 */

/* compute the reimainder as r = i - 10*q */
r = ((q<<2) + q) << 1; /* times 1010. */
r = i - r;

/* fixup if approximate remainder out of bounds */
if (r >= 10) {
r = r - 10;
q = q + 1;
}
}

In first two right-shift-and-add statements used above, we have assumed that the carry out of the high bit of the add operation is shifted into the high bit of the second of the two right-shift operations used in each statement. This can be done efficiently in many machine instruction sets, but even good optimizing compilers may insist on using a 16 bit accumulator for all intermediate results of arithmetic operations.

The second approach, using a more elaborate multiplier to give an exact quotient, may be coded as follows:

    /* quotient and remainder returned by div10 */
unsigned char q, r;

void div10( unsigned char i )
{
/* approximate the quotient as q = i*0.00011001101 (binary) */
q = ((i>>2) + i) >> 1; /* times 0.101 */
q = ((q ) + i) >> 1; /* times 0.1101 */
q = ((q>>2) + i) >> 1; /* times 0.1001101 */
q = ((q ) + i) >> 4; /* times 0.00011001101 */

/* compute the reimainder as r = i - 10*q */
r = ((q<<2) + q) << 1; /* times 1010. */
r = i - r;
}

The particular choice of one or the other of these schemes can only be made after compiling them or hand translation to machine code. Depending on the specific features offered by the target architecture, either of the above may be the fastest or most compact, and careful use of small optimizations may tilt the balance one way or the other.

Depending on the space-time tradeoffs of the application, the above code may be expanded in-line as an open macro, or it may be called as a closed function. If in-line expansion is appropriate, it should be noted that the computations of c 3 and c 4 involve dividends no greater than 65. For dividends up to 68, the multiplier 0.0001101 gives exact results, suggesting the following version of the print routine:

    void putdec( short int n )
{
unsigned char d4, d3, d2, d1, d0, q;

if (n < 0) {
putchar( '-' );
n = -n;
}

d1 = (n>>4) & 0xF;
d2 = (n>>8) & 0xF;
d3 = (n>>12) & 0xF;

d0 = 6*(d3 + d2 + d1) + (n & 0xF);
q = (d0 * 0xCD) >> 11;
d0 = d0 - 10*q;

d1 = q + 9*d3 + 5*d2 + d1;
q = (d1 * 0xCD) >> 11;
d1 = d1 - 10*q;

d2 = q + 2*d2;
q = (d2 * 0x1A) >> 8;
d2 = d2 - 10*q;

d3 = q + 4*d3;
d4 = (d3 * 0x1A) >> 8;
d3 = d3 - 10*d4;

putchar( d4 + '0' );
putchar( d3 + '0' );
putchar( d2 + '0' );
putchar( d1 + '0' );
putchar( d0 + '0' );
}

All multiplications in the above code can be reduced to short sequences of shift and add instructions, and it is straightforward to add the code discussed earlier to suppress leading zeros from this code.

All of these details are incorporated into the attached decimal print routine for the 14-bit family of PIC microcontrollers.

 

Thanks to Mark Ramsey, who, on January 22, 2007 pointed out two small typos with big consequences in the section on Living Within 8 Bits .

Thanks to Dennis Vlasenko, who, on June 15, 2007 pointed out more typos in the section on Doing Without Multiply and Divide .

Thanks to Joe Zbiciak, who, on August 23, 2007 pointed out a small error the introduction.

16进制转浮点数在线工具对比评测:哪个工具最准确? 本文深入评测了五款主流16进制转浮点数在线工具,重点分析了它们在FP32和FP64浮点数转换中的准确性和功能差异。通过实际测试和工程案例,帮助开发者选择最适合的工具,并提供了自建校验工具的实用指南,确保数据转换的精确性。 阅读详情

相关推荐

浮点数与十六进制转换工具的设计与应用

本文还有配套的精品资源,点击获取 简介:浮点数与十六进制转换在编程、硬件设计和数据处理中极为重要,本软件专注于提供这两者间转换的便捷工具。浮点数根据IEEE 754标准,分为符号位、指数和尾数三部分,十六进制由数字和字母组成,一位对应4位二进制。软件支持用户输入浮点数转换为十六进制,亦可逆向转换,帮助开发者调试代码、分析内存数据或硬件工程师设计测试电路。软件测试用例验证转换...

weixin_42576410的博客 1300

16进制数转浮点数在线转换器

16进制数转浮点数在线转换器

key12315的专栏 1万+

binary_to_decimal

binary_to_decimal 将二进制代码转换为无符号十进制。 C代码包括<math.h>库。 在Linux上编译文件: :: $ gcc bin_to_dec.c -lm -o bin_to_dec 在Linux中执行: :: $。\ bin_to_dec 输出程序:

C#之浮点数与十六进制数互转小工具

有时候,笔者遇到需要将浮点数转换成十六进制数后,与其他设备相互进行通信的情况。所以,为了便于验证数据是否正确和练习C#编程,就写了一个小小小小小工具。 首先是要读取TextBox中输入的浮点数(包括单精度float和双精度double),具体方法程序参考笔者之前的博客C#使用TextBox作数据输入方法 既然是两种数据类型互转,所以还以使用TextBox输入十六进制数。具体方法程序如下: private void button3_Click(object sender, EventArgs e)

学无止境 5770

SPSS(二)SPSS实现多因素方差分析模型(图文教程+数据集)

SPSS(二)SPSS实现多因素方差分析模型 单因素方差分析上一篇博客https://blog.youkuaiyun.com/LuYi_WeiLin/article/details/89917656已经介绍完毕 这篇博客我们主要来学习多因素方差分析 多因素方差分析,就是同时考虑若干个控制因素的情况下,分别分析它们的改变是否造成观察变量的显著变动 (多个自变量,一个因变量)自变量类型以分类变量为主也可以...

可乐联盟 6万+

Linux系统下Materials Studio 2020安装避坑指南:从依赖包到许可证配置全流程

本文提供了一份在Linux系统上安装Materials Studio 2020的深度避坑指南。详细解析了从系统依赖包检查、安装流程、许可证配置到Gateway服务部署的全过程,并分享了与Slurm作业调度系统集成的实战经验,旨在帮助用户高效、稳定地完成部署。

weixin_29313547的博客 387

浮点数十六进制转换工具

在嵌入式开发中,很多情况会要分析协议,协议中有时候会出现二进制传输的浮点数,可以用分析工具查看浮点数对应的十六进制数,但要换算成十进制还是挺麻烦的,因此自己写了一个浮点数十六进制转换的工具。

庞景元的技术专栏 7733

最新版IAR9.40和注册工具

IAR最新版的IDE在编译速度和代码提示等各个方面上都有很大提升,软件这个东西果然还是越新越好。之前的时候,IAR v9系列网上很多人都说能用,但是又没有把 IAR v9系列的注册方法写的很清楚,导致我一直都用注册老版本v8的方法去注册v9。结果注册后都会提示。

xue_nuo的博客 4万+

C语言再学习 -- 单精度(float)和双精度(double)浮点数 与 十六进制(HEX) 之间转换(转载))

单精度浮点float:可以精确到小数点后6位双精度浮点double:可以精确到小数点后12位C可以通过f或F后缀是编译器把浮点常量当做float类型,比如2.3f和9.11E9F。l或L后缀使一个数字成为long double类型,比如54.3l和4.32e4L。建议使用L后缀,因为字母l和数字1容易混淆没有后缀的浮点常量为double类型。(重点)。例:sizeof(1.9) = 8;

不积跬步,无以至千里 1万+

智能车图像处理24-进阶篇16--三叉路口的判断

这篇文章主要讲述图像处理中如何判断三叉路口并进行补线操作。

taiyuezyh的博客 1万+

车载以太网网络测试-27【SOME/IP-SD简述】

SOME/IP-SD协议是基于IP的可扩展面向服务中间件中的服务发现协议,是汽车电子和嵌入式系统中实现动态服务发现与通信的核心组件。该协议规范详细说明了协议SOME/IP服务发现(SOME/IP-SD)的格式、消息序列和语义。本文将对SOME/IP-SD协议进行详细介绍。

车载网络测试工程师的博客 1956

【免费下载】 十六进制(HEX)和浮点类型(float、double)转换工具

十六进制(HEX)和浮点类型(float、double)转换工具 【下载地址】十六进制HEX和浮点类型floatdouble转换工具 本仓库提供了一个高效且实用的工具,用于进行十六进制(HEX)格式数据与浮点型(float、double)数据之间的相互转换。对于从事嵌入式开发、网络编程或是数据分析等领域的朋友而言,这一工...

gitblog_09723的博客 5047

Xilinx FPGA ICAP原语实现多重配置

众所周知,常见的FPGA通常为SRAM结构,固件程序一般存放在外置的串行Flash中,比如SPI Flash,M25P16或N25Q128等。 FPGA启动时,一般先从SPI起始地址开始加载数据到内部的SRAM,加载完成、校验通过则会直接运行。 那么有没有可能在SPI Flash中存放两个或多个FPGA固件呢?

whik1194的博客 4614

浮点数-十六进制转换

所以网站是阅读顺序: 0x3ea45a1c, 由左到右是 高字节-->低字节,VS是存储顺序: 由左到右 是 低字节-->高字节。

wuqi1003的专栏 7243

SAP-ABAP:FI财务会计模块常用BAPI及核心用途实例说明

SAP FI模块的BAPI覆盖了从主数据管理、凭证过账到财务关账的全流程操作,是系统集成与自动化的重要工具。实际应用中需结合业务场景选择合适的BAPI,并严格遵循事务控制与校验规则。如需扩展功能,可通过BAdI或用户出口增强标准逻辑。

baidu_35680696的博客 1601

FPGA上的时间数字转换器(TDC):详细概述及FPGA开发

本文对基于FPGA的时间数字转换器(TDC)进行了详细的概述,并提供了一个简单的示例代码,展示了如何在FPGA上实现TDC功能。在本文中,我们将详细概述基于FPGA的TDC,并提供相应的源代码示例,以帮助读者理解和实现这一功能。需要注意的是,这只是一个简单的示例,实际的TDC设计可能需要更多的功能和优化,以满足特定的需求。读取和重置:最后,测量结果可以通过读取计数器的值来获取,并且在每次读取后需要将计数器重置为零,以便进行下一次测量。TDC的基本原理是测量信号的到达时间与参考时钟之间的时间差。

EsqpWeller的博客 6868

【免费下载】 HEX-Float转换工具:数据格式转换的利器

HEX-Float转换工具:数据格式转换的利器 【下载地址】HEX-Float转换工具 本项目提供了一个简单易用的工具,用于将16进制数据转换为浮点数(float)或双精度浮点数(double)类型。该工具对于需要进行数据格式转换的开发者和研究人员来说非常实用。 ...

gitblog_09784的博客 1849

SIMATIC S7-1200, S7-1500 PID 控制[手册]

SIMATIC S7-1200, S7-1500 PID 控制[手册]

在线进制转换工具网址

另外也可以进行多种其它进制得转换,如:2进制、4进制、8进制、12进制等。,也可以进行16进制转浮点数等转换,比较方便;16进制和浮点数在线相互转换;

weixin_45543630的博客 3971

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

浮点数在计算机中存储方式、十六进制(HEX)和浮点类型(float、double)转换

浮点数在计算机中存储方式 浮点类型转换为十六进制 方法1:用地址用指针 方法2:用共用体 方法3:使用memcpy 十六进制转换为浮点类型

zhuguanlin121的博客 1万+

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

c语言字 字符串转换成数组_C语言常用的一些转换工具函数!

1、字符串转十六进制代码实现:voidStrToHex(char*pbDest,char*pbSrc,intnLen){charh1,h2;chars1,s2;inti;for(i=0;i{h1=pbSrc[2*i];h2=pbSrc[2*i+1];s1=toupper(h1)...

weixin_39946798的博客 2814

16 bit float 存储_一文帮你读懂Java浮点数的存储原理

前言Java数值分整数和浮点数,前一篇文章已经解析了Java整数的存储原理,本篇将接着解析浮点数在计算机里的存储原理。Java浮点数分单精度类型( float)和双精度类型(double),float 数据占用 32bit,double 数据占用 64bit。Java浮点数标准java中浮点数采用的IEEE754标准,该标准的全称为IEEE二进制浮点数算术标准。这个标准规定的存储格式是这样的:符号...

weixin_39592137的博客 667

三步把Spotify变成卡拉OK屏:Lyrics Plus歌词插件完整指南

开车通勤听到熟歌,最想要的就是跟着滚动的同步歌词。给Spotify装上 spicetify-cli 仓库里的 Lyrics Plus 插件,桌面端立刻拥有多源同步歌词、卡拉OK逐字高亮和日韩中文字转换。 ## 先跑起来:从克隆仓库到歌词同步 1. 克隆仓库(命令行工具和插件源码都在里面):`git clone https://gitcode.com/gh_mirrors/sp/spicetif

gitblog_09701的博客 485

IEEE_754_16进制转十进制浮点数 工具

IEEE_754_16进制转十进制浮点数 工具 【下载地址】IEEE_754_16进制转十进制浮点数工具 这是一个高效的IEEE_754格式16进制转十进制浮点数工具,专为需要处理二进制浮点数据的用户设计。经过严格测试,工具表现出卓越的准确性和稳定性,能够快速完成转换任务,显著提升工作效率。无论是科研、工程还是开发领域,...

gitblog_06773的博客 337

【亲测免费】 HEX-Float转换工具

HEX-Float转换工具 【下载地址】HEX-Float转换工具 本项目提供了一个简单易用的工具,用于将16进制数据转换为浮点数(float)或双精度浮点数(double)类型。该工具对于需要进行数据格式转换的开发者和研究人员来说非常实用。 ...

gitblog_09820的博客 1419

浮点数与16进制互转工具:轻松实现数值转换,提高工作效率

浮点数与16进制互转工具:轻松实现数值转换,提高工作效率 【下载地址】float与16进制互转工具 这款float与16进制互转工具为您提供了便捷的数值转换体验,轻松实现float与16进制之间的双向转换。无论是科研、编程还是日常数据处理,它都能快速、准确地完成转换任务,节省您的时间和精力。工具设计简洁,操作直观,确保转...

gitblog_06726的博客 989
上一篇: Reciprocal Multiplication, a tutorial
下一篇: C51语法错误日记(1)
海之渊
博客等级 码龄19年 15粉丝 31原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值