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
4
votes
1 answer

Optimized FFT and mathematics for AT91SAM9 ARM processor Linux userspace program

I'm developing C/C++ software for an embedded Linux system with the AT91SAM9G20 processor from Atmel. I need to quickly compute the FFT using fixed-point (or perhaps floating-point) math using a Linux userspace program. I understand that assembler…
Nicholas Kinar
  • 1,440
  • 5
  • 24
  • 36
4
votes
4 answers

Advantages and disadvantages of floating point and fixed point representations

I have been trying for the last three days to understand the exact differences between floating and fixed point representations. I am confused reading the material and I'm unable to decide what is right and what is wrong. One of the problems is…
progammer
  • 1,951
  • 11
  • 28
  • 50
4
votes
1 answer

Fast inverse square root using fixed point instead of floating point

I am trying to implement Fast Inverse Square Root for a fixed point number, but I'm not getting anywhere. I am trying to follow exactly the same principle as the article, except instead of writing the number in the floating point format x = (-1) ^ s…
vicente cesar
  • 43
  • 1
  • 4
4
votes
2 answers

Does it ever make sense to specify 'Small and 'Delta separately?

Demonstrator of compiler-selected 'Small Being new to fixed point types in Ada, it surprised me to hear that the default value of 'Small is a power of 2, smaller or equal to the delta specified. Here is a short snippet to introduce the problem: with…
TamaMcGlinn
  • 2,840
  • 23
  • 34
4
votes
2 answers

Fixed Point MATLAB DSP Algorithm

I've got a question about coding an algorithm for a Texas Instruments TMS320C64xx DSP in MATLAB: I've got a working sloppy implementation of my filter in MATLAB. My goal is to use MATLAB Embedded Coder to convert this algorithm to C which I can then…
NickHalden
  • 1,469
  • 2
  • 20
  • 31
4
votes
2 answers

how to use the native fixed point type (8.24) for iOS audio processing

so i want to properly scale floats in the range of -1 to +1 into the format expected by an AUGraph with a stream format that is set up like this: size_t bytesPerSample = sizeof (AudioUnitSampleType); // is 4 bytes stereoStreamFormat.mFormatID …
Jakob
  • 872
  • 10
  • 26
4
votes
2 answers

Strange compilation error with gnat on fixed point declaration

Compilation fails with the F6 declaration below : type F3 is delta 2.0**(-4) range 0.0 .. ((2.0**8)-1.0)*2.0**(-4); -- byte 16#f.f#; for f3'size use 8; type F4 is delta 2.0**(-8) range 0.0 .. ((2.0**16)-1.0)*2.0**(-8); -- word 16#ff.ff# for…
4
votes
3 answers

Rotate ImageView in Android around a fixed point using RotateAnimation

I'd like to rotate an image 360 degrees continuously around a fixed point. I've seen a few examples already such as: RotateAnimation anim = new RotateAnimation(0, 360,150,150); anim.setInterpolator(new…
mmmbaileys
  • 1,233
  • 4
  • 18
  • 33
4
votes
2 answers

Optimizations are killing my integer overflow checks in clang 6

I have a fixed-point implementation for some financial application. It's basically an integer wrapped in a class that is based on the number of decimals given Ntreated as a decimal number. The class is paranoid and checks for overflows, but when I…
The Quantum Physicist
  • 24,987
  • 19
  • 103
  • 189
4
votes
0 answers

fixed point decimals arithmetic in R

I'm looking for a package or any other solution that will help me in handling fixed point decimal numbers, their arithmetic and rounding in R. The main purpose is to make monetary calculations without floating point errors and being able to control…
Tomasz
  • 41
  • 2
4
votes
0 answers

Using Eigen Library for fixed-point matrix multiplication

Does Eigen Library have support for fixed-point multiplication? Currently, I perform matrix multiplication without Eigen Library and use the following fixed-point multiplication function: https://stackoverflow.com/a/31662911/4921865 The best I can…
4
votes
2 answers

Matlab Double cast from Uint64

I am casting a 64bit fixed point number to floating point. How should that be done in Matlab? The following code gives different results. What is the difference between typecast and the double(x) temp = 2^32*uint64(MSB) + uint64(LSB); out_0(1, 1)…
user1876942
  • 1,411
  • 2
  • 20
  • 32
4
votes
0 answers

Problems with the representation in the workspace of the numbers in fixed point

Hi everyone and thanks in advance! I am having problems with the function fi (Matlab function to convert data in fixed point type). I am using Matlab R2015a. When I use this function with a vector the representation in the workspace is not correct…
4
votes
1 answer

Reading floating-point numbers from file in COBOL

I have fixed-point numbers in file, one in each line, in this format S9(6)V9(2) but when they are actually read, I'm getting non numeric errors while trying to put them in math operations. What is more, when I try to display them in program, a…
Quentin
  • 1,090
  • 13
  • 24
4
votes
1 answer

Power of 2 approximation in fixed point

Currently, I am using a small lookup table and linear interpolation which is quite fast and also accurate enough (max error is less than 0.001). However I was wondering if there is an approximation which is even faster. Since the integer part of the…
maniacmic
  • 414
  • 8
  • 15