fpu


What algorithms do FPUs use to compute transcendental functions?

帅比萌擦擦* 提交于 2020-01-13 09:01:07
问题 What methods would a modern FPU use to compute transcendental functions? For example, Intel CPUs provide instructions such as FSIN , FCOS , FYL2X , etc. I am curious as to what algorithms would be used to actually implement these in hardware. My naïve guess would be Taylor series perhaps combined with some lookup tables, but that's nothing more than a wild guess. Please enlighten me. P.S. This question is more general than just Intel hardware. 回答1: One place to start could be "New Algorithms

How to clear stack in masm32 coprocessor (FPU)?

风格不统一 提交于 2020-01-06 19:55:22
问题 Doing some operations in masm32 FPU . But I'm not able to clear the stack of FPU e.g. ST(0)-ST(7) afterwards. Is there any instruction for stack clearing. Can you suggest anything? P.S. Suppose to clear stack for further calculation. 回答1: You can use FINIT which initializes the FPU and tags the data registers ST(0)-ST(7) as empty (it does not clear their contents though) 来源: https://stackoverflow.com/questions/34840658/how-to-clear-stack-in-masm32-coprocessor-fpu

Floating point calculations in a processor with no FPU

别说谁变了你拦得住时间么 提交于 2020-01-03 15:17:28
问题 Is it possible to perform floating point operations in an embedded processor that does not have a Floating Point Unit? 回答1: Yes, you just have to do it in software. Your compiler may provide support, or you may need to roll your own. There are freely-available implementations, too. 回答2: Yes, e.g. early Linux kernels did emulate i387 floating point instructions in the kernel. It was rather slow, but allowed you to use the same binary on computers with and without a floating point unit. 来源:

FLD floating-point instruction

╄→гoц情女王★ 提交于 2019-12-31 05:44:19
问题 According to http://cs.smith.edu/~thiebaut/ArtOfAssembly/CH14/CH14-4.html#HEADING4-5 14.4.4.1 The FLD Instruction fld mem_32 fld mem_64[bx] My objective is store a constant 10 into my fPU stack. Why I cant do this? __asm { move bx, 0x0004; fld dword ptr[bx] or fld bx; //------- fld 0x004; //Since it is 32 bits? fild 0x004; } 回答1: At least three things can go wrong here. One is the syntax of the assembler. The second is instruction set architecture. The third is the memory model (16 bit vs 32

FLD floating-point instruction

◇◆丶佛笑我妖孽 提交于 2019-12-31 05:44:10
问题 According to http://cs.smith.edu/~thiebaut/ArtOfAssembly/CH14/CH14-4.html#HEADING4-5 14.4.4.1 The FLD Instruction fld mem_32 fld mem_64[bx] My objective is store a constant 10 into my fPU stack. Why I cant do this? __asm { move bx, 0x0004; fld dword ptr[bx] or fld bx; //------- fld 0x004; //Since it is 32 bits? fild 0x004; } 回答1: At least three things can go wrong here. One is the syntax of the assembler. The second is instruction set architecture. The third is the memory model (16 bit vs 32

MSVC win32: convert extended precision float (80-bit) to double (64-bit)

女生的网名这么多〃 提交于 2019-12-29 04:54:24
问题 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 inline asm is not available for win64 code in MSVC. Do I need to move this assembler code to separate .asm file? Is that really so there are no good solution? 回答1:

iPhone 4 and iPad 2: Advantages of fixed point arithmetic over floating point

怎甘沉沦 提交于 2019-12-24 01:25:49
问题 I've heard that the iPhone 4 and the iPad have a fpu called the VFP that in some way optimizes floating point arithmetic, even allowing SIMD (though whether GCC takes advantage of that is doubtful). However, I've read that for some Android devices, the speedup of using fixed point over floating point can lead to increases of 20x in performance. What would be the advantages of implementing a floating point-intensive part of my code using fixed point arithmetic over floating point in those

division as multiply and LUT ? / fast float division reciprocal

本小妞迷上赌 提交于 2019-12-22 14:59:23
问题 Is it possible to make a reciprocal of float division in form of look up table (such like 1/f -> 1*inv[f] ) ? How it could be done? I think some and mask and shift should be appled to float to make it a form of index? How would be it exectly? 回答1: You can guess an approximate inverse like this: int x = bit_cast<int>(f); x = 0x7EEEEEEE - x; float inv = bit_cast<float>(x); In my tests, 0x7EF19D07 was slightly better (tested with the effects of 2 Newton-Raphson refinements included). Which you

Floating point rounding when truncating

六眼飞鱼酱① 提交于 2019-12-22 10:58:58
问题 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 "source" generated value is from an exclusive upper bound. The catch here is that the underlying generator returns an 8-byte double, but I only want a 4-byte

How can I set and restore FPU CTRL registers?

别说谁变了你拦得住时间么 提交于 2019-12-22 07:07:21
问题 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 gives another value. What I need, is in essential is to do this: _controlfp(_CW_DEFAULT, 0xfffff); So my floatingpoint calculations in the .net code does not crash,

工具导航Map