Questions tagged [x87]

x87 is the legacy 80bit floating point subset of the x86 instruction set. It's obsoleted by SSE/SSE2 for float/double, but is still useful for 80bit extended precision. The 32bit x86 ABI also returns FP results in an x87 register. See the tag wiki for a tutorial link.

See the wiki for links, including the most useful one: http://www.ray.masmcode.com/tutorial/index.html.

249 questions
59
votes
3 answers

Usefulness of signaling NaN?

I've recently read up quite a bit on IEEE 754 and the x87 architecture. I was thinking of using NaN as a "missing value" in some numeric calculation code I'm working on, and I was hoping that using signaling NaN would allow me to catch a floating…
user123456
44
votes
4 answers

Extended (80-bit) double floating point in x87, not SSE2 - we don't miss it?

I was reading today about researchers discovering that NVidia's Phys-X libraries use x87 FP vs. SSE2. Obviously this will be suboptimal for parallel datasets where speed trumps precision. However, the article author goes on to quote: Intel started…
codekaizen
  • 26,990
  • 7
  • 84
  • 140
28
votes
5 answers

Benefits of x87 over SSE

I know that x87 has higher internal precision, which is probably the biggest difference that people see between it and SSE operations. But I have to wonder, is there any other benefit to using x87? I have a habit of typing -mfpmath=sse…
Tom
  • 10,689
  • 4
  • 41
  • 50
25
votes
4 answers

Memory corruption in System.Move due to changed 8087CW mode (png + stretchblt)

I have strange a memory corruption problem. After many hours debugging and trying I think I found something. For example: I do a simple string assignment: sTest := 'SET LOCK_TIMEOUT '; However, the result sometimes becomes: sTest = 'SET…
André
  • 8,920
  • 1
  • 24
  • 24
17
votes
1 answer

Why are Intel x87 registers 80 bits wide?

Why is such a “weird” register size used? Is there any documentation on why it is not preferable to use 64 or 128 bits for those registers?
JohnTortugo
  • 6,356
  • 7
  • 36
  • 69
16
votes
5 answers

What are the applications/benefits of an 80-bit extended precision data type?

Yeah, I meant to say 80-bit. That's not a typo... My experience with floating point variables has always involved 4-byte multiples, like singles (32 bit), doubles (64 bit), and long doubles (which I've seen referred to as either 96-bit or 128-bit).…
gnovice
  • 125,304
  • 15
  • 256
  • 359
16
votes
2 answers

Calling fsincos instruction in LLVM slower than calling libc sin/cos functions?

I am working on a language that is compiled with LLVM. Just for fun, I wanted to do some microbenchmarks. In one, I run some million sin / cos computations in a loop. In pseudocode, it looks like this: var x: Double = 0.0 for (i <- 0 to 100 000…
Erkki Lindpere
  • 597
  • 5
  • 11
14
votes
1 answer

Is x87 FP stack still relevant?

I notice compilers generate code that targets SIMD registers every time double arithmetic is used. This applies to non-optimized as well as optimized code. Does this mean the x87 FP unit can be considered obsolete and only present for backward…
user3735658
14
votes
2 answers

Is SSE floating-point arithmetic reproducible?

The x87 FPU is notable for using an internal 80-bit precision mode, which often leads to unexpected and unreproducible results across compilers and machines. In my search for reproducible floating-point math on .NET, I discovered that both major…
Asik
  • 21,506
  • 6
  • 72
  • 131
12
votes
4 answers

Simplest way to remove something from the FPU stack

I've been having some trouble lately with FPU stack overflows. I managed to track it back to a buggy library function that pushes a garbage value onto the FPU stack every time it's called and never cleans it up. Fortunately, this is easily…
Mason Wheeler
  • 82,511
  • 50
  • 270
  • 477
11
votes
3 answers

Why does pow() calculate wrong when Webkit is running?

I have a Qt C++ application where there is a GUI thread in which some floating point calculation happens. It also opens QWebView where there is a flash player with some video. It is obvious that closing of QWebView interfere on new next floating…
Ezee
  • 4,214
  • 1
  • 14
  • 29
10
votes
2 answers

Why does this simple program compiled with gcc,-mfpmath=387, and an optimization level of -O2 or -O3 produce NaN values?

I have a short program that performs a numerical computation, and obtains an incorrect NaN result when some specific conditions hold. I cannot see how this NaN result can arise. Note that I am not using compiler options that allow the reordering…
Szabolcs
  • 24,728
  • 9
  • 85
  • 174
10
votes
5 answers

How do I specify immediate floating point numbers with inline assembly?

When I try to compile this code: #include main(int argc, char *argv[]) { double y = 0; __asm__ ("fldl $150;" "fsqrt;" "fstl %0;" : : "g" (y) ); printf("%f\n", y); return 0; } I get this…
poundifdef
  • 18,726
  • 23
  • 95
  • 134
10
votes
1 answer

What's the difference between the x86 NOP and FNOP instructions?

I was reading the Intel instruction manual and noticed there is a 'NOP' instruction that does nothing on the main CPU, and a 'FNOP' instruction that does nothing on the FPU. Why are there two separate instructions to do nothing? The only thing…
Michael Burge
  • 425
  • 9
  • 16
9
votes
3 answers

Is there any way to get correct rounding with the i387 fsqrt instruction?

Is there any way to get correct rounding with the i387 fsqrt instruction?... ...aside from changing the precision mode in the x87 control word - I know that's possible, but it's not a reasonable solution because it has nasty reentrancy-type issues…
R.. GitHub STOP HELPING ICE
  • 208,859
  • 35
  • 376
  • 711
1
2 3
16 17