I need to speed up a program for the Nintendo DS which doesn't have an FPU, so I need to change floating-point math (which is emulated and slow) to fixed-point.
How I started was I changed floats to ints and whenever I needed to convert them, I used x>>8 to convert the fixed-point variable x to the actual number and x<<8 to convert to f...
I'm looking for a fixed-point standard to use for financial data, do you know any that is worth trying? Do you have any experience on the performance of that hand-made fixed-point classes?
...
I want to invert a 4x4 matrix. My numbers are stored in fixed-point format (1.15.16 to be exact).
With floating-point arithmetic I usually just build the adjoint matrix and divide by the determinant (e.g. brute force the solution). That worked for me so far, but when dealing with fixed point numbers I get an unacceptable precision loss ...
For intense number-crunching i'm considering using fixed point instead of floating point. Of course it'll matter how many bytes the fixed point type is in size, on what CPU it'll be running on, if i can use (for Intel) the MMX or SSE or whatever new things come up...
I'm wondering if these days when floating point runs faster than ever...
In C++, what's the generic way to convert any floating point value (float) to fixed point (int, 16:16 or 24:8)?
EDIT: For clarification, fixed-point values have two parts to them: an integer part and a fractional part. The integer part can be represented by a signed or unsigned integer data type. The fractional part is represented by ...
Hi there, I was wondering if anyone here knows of any good resources for fixed point math in c#? I've seen things like this (http://2ddev.72dpiarmy.com/viewtopic.php?id=156) and this (http://stackoverflow.com/questions/79677/whats-the-best-way-to-do-fixed-point-math), and a number of discussions about whether decimal is really fixed poin...
Hi guys,
1) I've got many constants in my C algo.
2) my code works both in floating-point and fixed-point.
Right now, these constants are initialized by a function, float2fixed, whereby in floating-point it does nothing, while in fixed-point, it finds their fixed-point representation. For instance, 0.5f stays 0.5f if working in floatin...
I need to convert a C/C++ double to a 64 bit two's complement, where the Radix point is at bit number 19 (inclusive).
This means that for the format I want to convert to
0x0000 0000 0010 0000 is the number 1
0xFFFF FFFF FFF0 0000 is the number -1
0x0000 0000 0000 0001 is 0.95 x 10^-6
0xFFFF FFFF FFFF FFFF is -0.95 x 10^-6
So far ...
I know it's really stupid question, but I don't know how to do this in bash:
20 / 30 * 100
It should be 66,67 but expr is saying 0, because it doesn't support float.
What command in Linux can replace expr and do this equalation?
...
Hello, I was wondering if there is a compression algorithm, in common use today, that contains a fixed point, i.e., an identity file.
To explain, let's call C : byte[] -> byte[] a function that represents the compression algorithm. I want to know if there exists (and what it is, if it is possible to determine in reasonable time) a file ...
I wrote a small software synth for the iPhone.
To further tune performance I measured my application with Shark and found that I am loosing a lot of time in float/SInt16 conversions.
So I rewrote some parts to get around the conversions by pre-calculating lookup tables that return "ready-to-use" SInt16 samples. This works fine so far.
C...
Does anyone know a (preferably fast) way to calculate the sine of an angle in 4.12 fixed point? (where the result is either 32768ths of a circle or degrees)
4.12 fixed point means the number is 16 bits and is left shifted 12, so 1.0 becomes (1 << 12) or 4096. 0.5 is (0.5 << 12) == 2048, etc.
...
Hi.
I'm looking for a fast way to turn an array of complex numbers into polar representation.
E.g, given a complex number X I want to turn it into polar representation like this:
Q.phase = atan2 (X.imag / X.real);
Q.magniude = sqrt (X.imag * X.imag + X.real * X.real);
I need to do this conversion around 400 thousand times pe...
Hello,
I would like to code a calculator in Flex but can't find any fixed-point libraries on the web.
For the calculator, I need more precision then IEEE 754 can guarantee. For example:
trace(1.4 - .4); //should be 1 but it is 0.9999999999999999
Can someone suggest a good fixed-point library please ?
Thank you in advance
...
Most people seem to want to go the other way. I'm wondering if there is a fast way to convert fixed point to floating point, ideally using SSE2. Either straight C or C++ or even asm would be fine.
...
I am writing a class for handling decimal numbers, e.g. "123.456". I want one function for extracting the digits before the decimal point (123), and one function to extract the digits after the decimal point (0.456). My question is not how to do the programming, but how to name the functions? Do you have any better idea than digits_befor...
Is converting Fixed Pt. (fixed n bit for fraction) to IEEE double safe ?
ie: does IEEE double format can represent all numbers a fixed point can represent ?
The test: a number goes to floating pt format then back to it's original fixed pt format.
...
Hi,
I have an application which is using 24 bit fixed point calculation.I am porting it to a hardware which does support floating point, so for speed optimization I need to convert all fixed point based calculation to floating point based calculation.
For this code snippet, It is calculating mantissa
for(i=0;i<8207;i++)
{
// Do n^8/...
I'm working on a fluid dynamics Navier-Stokes solver that should run in real time. Hence, performance is important.
Right now, I'm looking at a number of tight loops that each account for a significant fraction of the execution time: there is no single bottleneck. Most of these loops do some floating-point arithmetic, but there's a lot ...
Hi All!
I have a formula which calculate position for Y, here it is:
double y = ...;
double minX = ..;
double scaleY = ..;
int MAX_COORD = (1 << 16) - 1;
int sy = ~(int)((y - minY) / scaleY * MAX_COORD) & 0xFFFF;
and now i have sy, and i need to calculate y like this:
y = (sy * scaleY) / MAX_COORD + minY;
but conversion is not equ...