I can reset FPU's CTRL registers with this:
http://support.microsoft.com/kb/326219
But how can I save current registers, and restore them later?
It's from .net code..
What I'm doing, is from Delphi calling an .net dll as an COM module. Checking the CTRL registers in delphi yield one value, checking with controlfp in the .net code giv...
I have a software project in which I sometimes get strange results from small, simple floating point operations. I assume there is something I have missed, and would like some tips about how to debug the following problems:
(the compiler used is MS VC 6.0, that is version 12 of the Microsoft C compiler)
First anomaly:
extern double ...
I would like to handle fpu exception on windows, something like:
#include <math.h>
#include <fenv.h>
#include <stdio.h>
int main()
{
double b = 0;
int raised;
feclearexcept (FE_ALL_EXCEPT);
b /= 0;
raised = fetestexcept (FE_OVERFLOW | FE_INVALID);
if (raised & FE_OVERFLOW) { printf("over\n");}
if (raised & F...
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 curious) only returns values in the range [1,2) - ie, I want an inclusive upper bound, but my...
Hello, I have used gdb to step through the assembler code that implement the standard C sin() function in the standard C math library (-lm -march=pentium3 -mfpmath=387). There is a lot of stub there and I don't know why they have not simply inlined the fsin assembler instruction. The same happens with other mathematic functions. Why they...
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 automatically in any project, and I wonder if I'm missing anything else that the x87 FPU offers.
...
Does anyone know what math methods are implemnted by the hardware of the processor for .net? For example, I have an algorithm that makes a lot of use of atan. I can easily write a lookup table for this, but if math.net implements this using an fpu or other hardware extensions, it's not going to be worth it.
...
I need to change the FPU control word from its default setting in a multithreaded application. Is this setting per-thread or per-process? Does it have different scopes under Mac OS X and Windows?
...
What determines the default setting of the x87 FPU control word -- specifically, the precision control field? Does the compiler set it based on the target processor? Is there a compiler option to change it?
Using Microsoft Visual C++ 2008 Express Edition on an Intel Core Duo processor, the default setting for the precision control field...
I have a one-liner C function that is just return value * pow(1.+rate, -delay); - it discounts a future value to a present value. The interesting part of the disassembly is
0x080555b9 : neg %eax
0x080555bb : push %eax
0x080555bc : fildl (%esp)
0x080555bf : lea 0x4(%esp),%esp
0x080555c3 : fldl 0xffff...
Hi, 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!
...
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 loop ?
Does someone already manupulate the ucontext_t structure on Linux ?
I finally found...
What is the most portable and "right" way to do conversion from extended precision float (80-bit value, also known as "long double" in some compilers) to double (64-bit) in MSVC win32/win64?
MSVC currently (as of 2010) assumes that "long double" is "double" synonym.
I could probably write fld/fstp assembler pair in inline asm, but inli...
Hi,
I read (http://www.stereopsis.com/FPU.html) mentioned in (http://stackoverflow.com/questions/78619/what-is-the-fastest-way-to-convert-float-to-int-on-x86). Does anyone know if the slow simple cast (see snippet below) does apply to ARM architecture, too?
inline int Convert(float x)
{
int i = (int) x;
return i;
}
To apply some ...
Hints and allegations abound that arithmetic with NaNs can be 'slow' in hardware FPUs. Specifically in the modern x64 FPU, e.g on a Nehalem i7, is that still true? Do FPU multiplies get churned out at the same speed regardless of the values of the operands?
I have some interpolation code that can wander off the edge of our defined data...
I have a strange problem that I can't seem to solve.
I'm developing in C/assembly on an embedded ARM board with no FPU, and using GCC's soft floats.
Everything is compiled with -msoft-float as a CFLAG
I'm trying to make an .a library in one directory and link with my kernel. When I do so, I get an error from ld:
ERROR: lib/libfoo.a(s...