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
2
votes
1 answer

FMUL does not clear overflow in STATUS register

I have this Win32 code: fld x fmul y fstsw ax It seems that fmul does not clear FPU status registers bit, i.e. if overflow was already set (ax & 8) then it will stay set after fmul. Is it the correct behavior? Is it required to clear status after…
queen3
  • 15,333
  • 8
  • 64
  • 119
2
votes
1 answer

Detecting the reason for EXCEPTION_FLT_STACK_CHECK

I have a compliacted C and C++ code with heavy mathematics calculations. I use intel C++ - the latest update to compile. I use optimizatons and the application does not give the expected answer. After a long time I managed to reduce the problem to…
Mordy Shahar
  • 107
  • 8
2
votes
2 answers

Is sinus scalable?

By sinus I mean here c stdlib sin() / fpu assembl;y fsin. I can give to this sinus argument with about 16 decimal digits presision or more, for example sin(1.1e-14); sin(1.2e-14) then get results, sinus is almost linear on such small deltas but…
grunge fightr
  • 1,360
  • 2
  • 19
  • 38
2
votes
1 answer

How can GCC use fildll when converting an unsigned int?

The Intel Instruction set reference claims (emphasis mine): Converts the signed-integer source operand into double extended-precision floating- point format and pushes the value onto the FPU register stack. The source operand can be a word,…
Janus Troelsen
  • 20,267
  • 14
  • 135
  • 196
1
vote
2 answers

division 8086/8087 1/3 =3?

I´m having a huge problem using fdiv!!!! I'm trying to divide 1/3 so this is what I do .model small .stack 100h .data var1 dd 1 var2 dd 3 var3 dd 2 resultado dt 0.0 .code mov ax,@data mov ds,ax finit fild var1 fild var2 fdiv fstp…
A Zuniga
  • 97
  • 1
  • 5
  • 15
1
vote
3 answers

Assembly 8086; Floating Point Numbers, Add, Subtract

I need some resources to get to know more about numbers with floating point, I need to code add and subtract operations for that kind of numbers in emu8086 environment .... Any help is much appreciated
Pooria Khodaveissi
  • 395
  • 1
  • 8
  • 16
1
vote
1 answer

Ambiguity in decoding specific x87 FPU instructions

I'm facing an ambiguous case with regard to decoding x87 FPU instructions. Take a look at the following instruction taken from page Page 3-380 of Vol 2A Intel's instruction set manual [1]. D9 /0 --> FLD m32fp --> Push m32fp onto the FPU register…
Hrishikesh Murali
  • 535
  • 3
  • 7
  • 16
1
vote
1 answer

Is fdiv faster with a dword or qword argument?

I can choose between the following 80387 instructions: fdiv dword ptr a and fdiv qword ptr b The numbers a and b are equivalent, both of them are 100% accurate. Is there a reason why I should choose the qword version? I can only think about speed…
pts
  • 80,836
  • 20
  • 110
  • 183
1
vote
1 answer

How to move data between x87 registers and SSE registers?

I'm not sure if this is possible, but I'd like to find a way to move a value between the x87 FPU registers, e.g., st(0) and the SSE registers, e.g., xmm1. The context is I'm computing the sine of some floating-point value stored in memory. My…
1
vote
1 answer

How to edit st(x) in fpu?when x>0

for example,i want to edit st(2) fstp [00777700] fstp [00777800] fstp [00777900] mov [00777900],xxx fld [00777900] fld [00777800] fld [00777700] that is my wrong way st(0,1,2) will be qnan
1
vote
1 answer

How to multiply 2 numbers (user input) using the floating point stack in asm?

I've created a PROC that will gather user input for a balance, interest rate & length of term (# of years) in a separate file. The interest rate is a floating point (fractional number - not an integer). I'm not sure if my balance needs to be…
user18102815
1
vote
0 answers

Intel 8087 floating point numbers

Good morning, I have to change the constant values "wired to code" for an old machine based on intel 8086 and intel 8087 coprocessor. I have the source code, written in the RTL/2 language. Unfortunately, I have no way to compile the source code. The…
Andak
  • 124
  • 12
1
vote
0 answers

How can I set the two-bit rounding control (RC) field of the FPU control word to 10 (round towards +infinity) using GAS in C

How can I set the two-bit rounding control (RC) field of the FPU control word to 10 (round towards +infinity) using GAS in C. Must use format asm( ); should only be about 7 lines of code altogether. first push RC register onto the stack, flip the…
Software X
  • 13
  • 4
1
vote
0 answers

Reserve FPU stack for clobbering in inline assembly

When writing math functions in inline assembly, is there a way of telling the compiler "I use 2 extra slots of the FPU-stack"? For example a exp implementation might look like this: asm("fldl2e\n" "fmulp\n" "fld1\n" "fld…
1
vote
0 answers

Variable loses floating point data between functions

I have a program where I have to pass arguments to my functions through registers, stack, and public variables, and it seems that I lose data between them, because even after the first function I get 0.0 in "save" variable I think that I messed up…
Mirinum
  • 33
  • 5