English 中文(简体)
怎样才能将愤怒转化为亲子的扼杀?
原标题:How are integers converted to strings under the hood?

我认为,真正的问题是如何将基数2/宾改为基数10。 最常见的应用可能是为产出提供说明:将双向数字数据库变成一系列特征。 如何做到这一点?

my guess: Seeing as there probably isn t a string predefined for each numerical value, I m guessing that the computer goes through each bit of the integer from right to left, each time incrementing the appropriate values in the char array/base10 notation places. If we take the number 160 in binary (10100000), it would know that a 1 in the 8th place means 128, so it places 1 into the third column, 2 in the second, and 8 in the third. The 1 in the 6th column means 32, and it would add those values to the second and first place, carrying over if needed. After this it s an easy conversion to actual char codes.

问题回答
while number != 0:
    nextdigit = number % 10
    AddToLeft(result, convert nextdigit to char)
    number = number / 10

它留给读者处理零和负数。

如何做到这一点取决于平台。 例如,英特尔型加工商为支持包装的BCD(Binary Coded Decimal)理学而建造。

请允许我指出,登记册<代码>al包含双亲00101010, decimal 42。

fushf ;store flags on the stack
std ;set decimal flag
sub bl, bl ;clear bl register
add bl, al ;add al to bl using BCD arithmetics
pop ;restore flags from stack

The upper four bits contain 0100, or decimal 4.
The lower four bits contain 0010, or decimal 2.

将这种数值转换为特性,从登记册中提取四比值,并增加48,以获得数字的特性代码。

首先,这是一个棘手的问题,因为它显然基于平台和语言。

例如, Java。 被宣布为秘密的愤怒实际上为32倍。

代表我们本应拥有的零点价值

100000000000000000000000000000000000000<= 主要的1(或零)表示是积极的。

这是因为贾瓦仓储的面值为负值的一半,为正值的一半。

因此,我的猜测是 Java:

页: 1

页: 1

步骤3: (jdk5+)利用Int32.toString()将斜体改为“0”。

这可能是错误的原因,我从未认为过这个问题。

我确实不认为任何语言都会试图将价值转换成一系列的果园,造成大量费用增加......

或者,根据我的数学经验,将双币值换算成正数,你将根据价值计算,而不是按字面重新计算:

    1    1  0  1  in binary

    1*2^3 + 1* 2^2 + 0*2^1 +1*2^0 = 13 in decimal     




相关问题
Delphi: generics and is -operator problem

Based on an earlier post, I ve written the following code. Please excuse the verbosity of this post. I believe it s better for all parties to have the full code available to test and comment on. ...

How to use argument in a cast with Delphi

How to do this in Delphi: procedure ToggleVisibility(ControlClass : TControlClass); var i : integer; begin for i := 0 to ComponentCount - 1 do if Components[i] is ControlClass then ...

Complicated C cast explanation

I m trying to figure out what the following code in C does? ((void(*)())buf)(); where buf is a char array.

Beginner: Extending a class in C#, am I doing it wrong?

Again disclaimer disclaimer still learning C# and OOP generally so I hope you ll be patient with me :) I am currently working with a CMS that has a class called FileVersion which basically contains a ...

Casting generic object array to two types

I ve got a method that receives an Object[] and then performs actions on that array. At first I was passing in this array as an IEnumerable<T> however the T can be of two different types. The ...

热门标签