Questions tagged [fpu]

A floating-point unit is a part of a computer system specially designed to carry out operations on floating point numbers.

From Wikipedia:

A floating-point unit (FPU, colloquially a math coprocessor) is a part of a computer system specially designed to carry out operations on floating point numbers. Typical operations are addition, subtraction, multiplication, division, and square root. Some systems (particularly older, microcode-based architectures) can also perform various transcendental functions such as exponential or trigonometric calculations, though in most modern processors these are done with software library routines.

259 questions
3
votes
1 answer

How to print floating point numbers from assembly?

I'm trying to print a floating point number by calling printf but it seems to always just print the pi value (3.1415) although the result, which is supposed to be the area of a circle, is supposed to be moved to the pi variable after being…
KMG
  • 1,433
  • 1
  • 8
  • 19
3
votes
3 answers

Floating point rounding when truncating

This is probably a question for an x86 FPU expert: I am trying to write a function which generates a random floating point value in the range [min,max]. The problem is that my generator algorithm (the floating-point Mersenne Twister, if you're…
Not Sure
  • 5,873
  • 3
  • 23
  • 29
3
votes
1 answer

Setting FPU in Windows & OS X

I'm doing a program to set the precision control of the FPU to 24 bits and the rounding mode to "near" using the _controlfp_s function. I want to create a dll for Windows and a bundle for OS X. I can't find _controlfp_s when compiling with Xcode, I…
Roberto
  • 11,557
  • 16
  • 54
  • 68
3
votes
1 answer

How to generate fpu code (not emulated) with ia16-elf-g++ compiler?

I've downloaded Sourcery IA16 compiler, which is a GNU C++ compiler for 16-bit targets, and it works (although, it does not support far pointers, and have some glitches with inline asm register allocation, whatever). But when I declare a float…
ern0
  • 3,074
  • 25
  • 40
3
votes
1 answer

MMX Instructions and the x87 FPU Tag Word

section .data qVar1: dq 1 section .bss var28: resb 28 section .text _main: ; Use an MMX instruction movq mm0, [qVar1] ; Move quadword from r/m64 to mm. ; Read Tag Word fstenv [var28] …
Bite Bytes
  • 1,455
  • 8
  • 24
3
votes
1 answer

Floating point operations in linux kernel module (again)

I searched a lot of other questions inside StackOverflow, but none of them really solved my problem. I am writing a linux kernel module and I need to compute a percentage value by diving an integer number by another integer number in order to get a…
Antonio Petricca
  • 8,891
  • 5
  • 36
  • 74
3
votes
1 answer

Floating point assembly on intel processor

I have been studying how floating point operations are performed on a 32 bit intel machine. I have disassembled the following lines of C code to obtain how the compiler translates these lines on assembly. a = 13; b = 5; d = (float) a / (float)…
MykelXIII
  • 1,085
  • 1
  • 8
  • 16
3
votes
1 answer

Confused about assembly FLD instruction m64fp

I'm so confused. I have some question about the FLD m64fp instruction, but I have no idea where to start. Because this is a homework, I'm not specifically asking for answers, but the method to solve the problem. Any suggestion or idea would be…
shjnlee
  • 221
  • 2
  • 6
  • 20
3
votes
1 answer

How to change FPU context in signal handler (C++/Linux)

I wrote a signal handler to catch FPE errors. I need to continue execution even if this happens. I receive a ucontext_t as parameter, I can change the bad operand from 0 to another value but the FPU context is still bad and I run into an infinite…
Henry Fané
  • 93
  • 2
  • 7
3
votes
2 answers

How to set double precision in C++ on MacOSX?

I'm trying to port _controlfp( _CW_DEFAULT, 0xffffffff ); from WIN32 to Mac OS X / Intel. I have absolutely no idea how to port this instruction... And you? Thanks!
moala
  • 5,094
  • 9
  • 45
  • 66
3
votes
1 answer

How to get 16 byte aligned address in assembly

I have to save floating-point registers into the stack. I tried to use fsave instruction. I do the following: fsave (%esp) But as an argument fsave uses 16 byte aligned address. I don't have an idea how to make address in %esp be 16 byte aligned.
SteepZero
  • 334
  • 2
  • 8
3
votes
2 answers

Does _control87() also set the SSE MXCSR Control Register?

The documentation for _control87 notes: _control87 [...] affect[s] the control words for both the x87 and the SSE2, if present. It seems that the SSE and SSE2 MXCSR control registers are identical, however, there is no mention of the SSE unit in…
IInspectable
  • 46,945
  • 8
  • 85
  • 181
3
votes
1 answer

What's the difference between V*** and F*** floating-point ARM instructions?

What's the difference between ARM VFP instructions starting with V and with F? Why doesn't the ARM Information Center list the F instructions in the assembly reference anymore? Most of them directly map to each other (for example, vcvtr.s32.f32 and…
Triang3l
  • 1,230
  • 9
  • 29
3
votes
1 answer

Detecting potential FPU conditions raised by a single statement

I'm using fenv to look for statements which produce overflows, underflows, inexact results, etc. However, am I correct in assuming that the compiler could reorder code on me and not implement the effect I actually desire? If so, how would I go about…
tj90241
  • 150
  • 6
3
votes
0 answers

Bench marking ARM NEON OpenMAx Numbers

I am currently working on bench marking the performance of Cortex-A8 processor by using various compilers(tried DS-5 and IAR) and various libraries (Openmax,NE10). I am specifically working on to see what NEON unit can achieve when compared 1.Only…
Aurum
  • 77
  • 12