I am reading CS:APP (an x86-64 assembly / low-level textbook) and it mentions:
From
floatordoubletoint, the value will be rounded toward zero. For example,1.999will be converted to1, while−1.999will be converted to−1.Furthermore, the value may overflow. The C standards do not specify a fixed result for this case. Intel-compatible microprocessors designate the bit pattern [10 ... 00] (TMinwfor word sizew) as an integer indefinite value. Any conversion from floating point to integer that cannot assign a reasonable integer approximation yields this value. Thus, the expression(int) +1e10yields-2147483648, generating a negative value from a positive one.
What is Intel-compatible microprocessors mentioned here? x86 architecture including AMD series?
Anyway, I have an Intel i5 with Win10 64bit machine and I tried under Visual Studio:
#include <iostream>
using namespace std;
int main() {
int b = (int)+1e10;
cout << b << endl;
}
and gets 1410065408 as output.
Also I tried int32_t and gets 1410065408 too.
So why don't I have the result -2147483648 which is [10 ... 00] as the book describes?