Questions tagged [fixed-point]

Questions about fixed-point arithmetic, done using a set number of decimal places. For the combinators used to encode recursion, use [fixpoint-combinators] instead. For the numerical method, use [fixed-point-iteration] instead. For the fixedpoint engine of Z3, use [z3-fixedpoint] instead.

Fixed point arithmetic uses a fixed radix position to do calculations, instead of a variable amount (floating point). Instead of representing numbers using the IEEE mantissa-and-exponent format, numbers are represented as integers which are scaled by a fixed amount. It can be faster and is, within its regime, more precise than floating-point.

Most questions deal with finding a suitable fixed-point library for [insert language here], as most languages lack fixed-point arithmetic in their standard libraries (although some have one natively). Also, different types of fixed point number exist based on the number of decimal points included (and thus accuracy) - see the Q format.

511 questions
0
votes
1 answer

Harris corner response in fixed-point integers?

in harris corner, the response is calculated as follows: R = det - K * tr^2 where the k (constant) is a floating point number with 0.04 default at few known libraries. Does this mean that the response (R) needs to be floating point as well? How then…
sramij
  • 4,775
  • 5
  • 33
  • 55
0
votes
1 answer

Using fixed-point toolboxt to simulate DSP's behaviour

I am using a Analog Devices DSP and I would like to do some simulations on a algorithm. From this I specified my architecture: F = fimath('MaxProductWordLength', 40, ... 'MaxSumWordLength', 40, ... 'OverflowAction', 'Saturate', ... …
nowox
  • 25,978
  • 39
  • 143
  • 293
0
votes
0 answers

Approximate logarithm of BigInteger

I am looking for a fast way to approximate the logarithm base 2 of a BigInteger. Speed and support for large numbers are more important than exact results. My current suggestion is: return BigInteger.valueOf(n.bitLength()); I highly assume that this…
aka
  • 2,723
  • 1
  • 14
  • 10
0
votes
2 answers

Fixed Point to Floating Point and Backwards

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.
Ahmed Khalaf
  • 1,220
  • 12
  • 28
0
votes
0 answers

iterate sum over array java

I need to perform an accumulative sum in an array in Java according to iteration number, like this. for (int it = 1; it < 3; it++) { for(int i = 0; i < simSource.length; i++) { for (int j = 0; j < resulting.length; j++) { …
gPxl
  • 95
  • 14
0
votes
1 answer

Is fixed point math faster than floating point on armv7-a?

Do libraries like libfixmath perform better than arm FP and NEON or is there no gain from fixed point over existing FP hw? I'm considering converting all instances of float in my code to a fixed point C++ class (similar to libfixmath) to optimize in…
0
votes
1 answer

vhdl - incrementing a vector in the complex plane by a fractional amount

I am working on a project that will generate and display the Mandelbrot set on a 640 x 480 vga display (other higher resolutions are planned). Mapping the VGA x coord to the complex plane is fairly straightforward - If I take the Mandelbrot x region…
John Horstkamp
  • 87
  • 1
  • 1
  • 10
0
votes
2 answers

Mul255 - what is it?

Some days ago I downloaded sources of SumatraPDF and started exploring it. I found that library MuPDF сontains on interesting function, but not understand it. static inline int fz_mul255(int a, int b) { int x = a * b + 128; x += x >> 8; …
0
votes
0 answers

Fractional number as input. Code in floating-point or fixed-point?

I have a text-file with a bunch of fractional numbers(like +-1.8423) that I'm going to feed to my module to do some calculations with. The calculations are as follows: temp1 = frac_num - integer_num temp2 = temp1*temp1 What do I need in my…
0
votes
2 answers

why Q.15 multiplication isn't working

Refering Notation for fixed point representation i have tried following, but i am totally confused. int q = 1<<15; printf("(sys3.b0 * q) = %hx \n",((0.2929 * q))); output is ((0.2929 * q)) = cc60 I expect to see 257d because from calculator,…
nmxprime
  • 1,506
  • 3
  • 25
  • 52
0
votes
2 answers

Why can these be declared as integers?

In a program that seems to work well I have the following declarations: #include #include "system.h" signed char input[4]; /* The 4 most recent input values */ char get_q7( void ); void put_q7( char ); void firFixed(signed char…
Niklas Rosencrantz
  • 25,640
  • 75
  • 229
  • 424
0
votes
1 answer

Fixed and floating point usage for Altera DE2?

I'm suppsed to implement two versions of the an algorithm that does a finite impulse response in software, one algorithm with floating-point format and the other algorithm with fixed-point format. Now I think that if I just use float variables for…
Niklas Rosencrantz
  • 25,640
  • 75
  • 229
  • 424
0
votes
4 answers

Is Multiplying a decimal number where all results are full integers, considered Floating Point Math?

Sorry for the wordy title. My code is targeting a microcontroller (msp430) with no floating point unit, but this should apply to any similar MCU. If I am multiplying a large runtime variable with what would normally be considered a floating point…
cde
  • 317
  • 1
  • 18
0
votes
0 answers

fixed point datatype with PHP 5

Am I wrong (I hope), but I don't find on PHP a fixed-point datatype !? Datatype like DECIMAL/NUMERIC from MySQL will be nice for doing operations on money without precision loss. Any ideas ?
Stef
  • 3,691
  • 6
  • 43
  • 58
0
votes
1 answer

32 bit mantissa representation of 2455.1152

If I wanted to represent -2455.1152 as 32 bit I know the first bit is 1 (negative sign) but I can get the 2455 to binary as 10010010111 but for the fractional part I'm not too sure. .1152 could have an infinite number of fractional parts. Would that…
user1766888
  • 417
  • 1
  • 8
  • 21