English 中文(简体)
2. 表面上的双向转变?
原标题:Double to int conversion behind the scene?

我很想知道,在幕后发生了什么事情,把一 double翻一番,改成一 in(5666.1)? 这是否比静态地向父母播放儿童阶级更加昂贵? 由于名义上和双面上的代表性基本不同,因此在这一过程期间将产生一些诱惑,费用也很高。

最佳回答

任何拥有本地浮点的CPU都将指示将浮点转换为勘探数据。 这一行动可以从几个周期到许多周期。 通常都有私营军事和保安公司的单独登记册,因此,在你能够使用之前,你还必须将 in户移至户登记册。 这可能是另一个行动,可能是昂贵的。 见你的处理手册。

电力促进委员会特别没有指示将企业部登记册中的ger移到户登记册。 必须从私营部门司储存到记忆和装上燃烧。 因此,你可以说,产生了临时变量。

如无硬件FP支持,则数字必须编码。 本组织的形式是:

sign | exponent + bias | mantissa

为了转换,你必须做这样的事情。

// Single-precision format values:
int const mantissa_bits = 23; // 52 for double.
int const exponent_bits = 8; // 11 for double.
int const exponent_bias = 127; // 1023 for double.

std::int32_t ieee;
std::memcpy( & ieee, & float_value, sizeof (std::int32_t) );
std::int32_t mantissa = ieee & (1 << mantissa_bits)-1 | 1 << mantissa_bits;
int exponent = ( ieee >> mantissa_bits & (1 << exponent_bits)-1 )
             - ( exponent_bias + mantissa_bits );
if ( exponent <= -32 ) {
    mantissa = 0;
} else if ( exponent < 0 ) {
    mantissa >>= - exponent;
} else if ( exponent + mantissa_bits + 1 >= 32 ) {
    overflow();
} else {
    mantissa <<= exponent;
}
if ( ieee < 0 ) mantissa = - mantissa;
return mantissa;

I.e., 略微指示和转移。

问题回答

如果密码生成者使用《英特尔SSE2指令》的规定,则总会有工作成绩的万国邮联专门指示。 这迅速,但并非一成不变。 这并不总需要任何法典。

静态预测取决于汇编者C++代码的生成,但通常没有运行时间成本,因为点子变化是在根据所投的假定信息进行汇编时计算的。

当您将双倍转换为星时,在X86系统中,汇编者将发布FIST(Floating-Point/Integer转化)指示,万国邮联将进行转换。 这种转换可以用软件进行,并且以这种方式在某些硬件上进行,或者如果方案需要的话。





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签