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

Ada 2012 - replace Fixed_Decimal_Type'Round() with customised version?

Recently I have had joyous success when providing my own replacement 'Write () procedure for a custom record type, such as... type Pixel_Format is record -- blah blah end record; procedure Pixel_Format_Write ( …
user5069935
2
votes
1 answer

Fixed Point Hardware Ray Tracing products compensation

I'm trying to replicate a implementation of integer calculi of ray-triangle intersection and I'm basing my code on the work of Johannes Hanika (https://jo.dreggn.org/home/2007_master.pdf). But I having a problem that I think it is in the following…
Jorgeluis
  • 197
  • 2
  • 7
2
votes
2 answers

Embedded C Cortex-M4: Properly handle division by big numbers?

I'm writing embedded code for spectroscopy. In order to build my spectrum, I need to map linearly samples from an interval (dynamic range is given by the physics/specs of the problem) to another. Basically after data is processed I have a series of…
a_bet
  • 370
  • 3
  • 14
2
votes
2 answers

Normalizing a two complement number

I am working on some Tensilica processor and I don't understand the normalization process. NSA - Normalized Shift Amount Usage:     NSA at, as NSA calculates the left shift amount that will normalize the twos complement contents of address register…
yo3hcv
  • 1,531
  • 2
  • 17
  • 27
2
votes
0 answers

Resources for fast fixed point algorithms

Looking for essentially what is posted in this much older thread https://dsp.stackexchange.com/questions/20444/books-resources-for-implementing-various-mathematical-functions-in-fixed-point-a It would seem that there are many well known "tricks"…
user979616
  • 273
  • 1
  • 6
  • 15
2
votes
1 answer

Reinterpret uint16 as fixed-point with 14 fractional bits in Python

I am sending data (signed 16bit fixed-point with 14 fractional bits) from one system to another. Due to constraints, the data has to be reinterpreted as uint16 before it is transmitted (i.e. bit representation is the same). The data ends up in…
jng
  • 23
  • 3
2
votes
3 answers

Emulated Fixed Point Division/Multiplication

I'm writing a Fixedpoint class, but have ran into bit of a snag... The multiplication, division portions, I am not sure how to emulate. I took a very rough stab at the division operator but I am sure it's wrong. Here's what it looks like so…
Anne Quinn
  • 12,609
  • 8
  • 54
  • 101
2
votes
0 answers

Neupy custom activation function

I am trying to create a custom activation layer base on the MNIST example in Neupy. However, once I apply my custom layer to the network, it stops training. For my custom function, I want to make the input value from a floating point value to a…
2
votes
1 answer

Converting between two fixed point representations

I am trying to convert a number from one fixed point representation to another. I am using the 2's complement representation (Qmf representation) This is to verify the hardware implementation. The hardware implementation works as follows: The input…
a220599
  • 39
  • 5
2
votes
2 answers

Converting byte[] of binary fixed point to floating point value

I'm reading some data over a socket. The integral data types are no trouble, the System.BitConverter methods are correctly handling the conversion. (So there are no Endian issues to worry about, I think?) However, BitConverter.ToDouble isn't working…
2
votes
3 answers

Improve performance of calculating log2 of a number between 1 and 2

I am trying to calculate log2(x) using integer-arithmetic operations. The input x is a value between 1 and 2. Because this will simply yield 0, everything is pre-scaled by 16. In other words: The function takes the integer value of x * 2^16 instead…
goodvibration
  • 5,980
  • 4
  • 28
  • 61
2
votes
3 answers

Deriving decimal types - fixed precision

Is there a way in .NET to create a type derived from decimal that would be used as a currency, so it rounds the arithmetic operations to the desired number of decimal points. If not, what are the best practice for it in .NET? EDIT…
Daniel Mošmondor
  • 19,718
  • 12
  • 58
  • 99
2
votes
2 answers

What is a fixed point integer?

In http://microformats.org/wiki/hreview-aggregate it says: rating. required. fixed point integer [1.0-5.0], with optional alternate worst (default:1.0) and/or best (default:5.0), also fixed point integers, and explicit average. What is a fixed…
nonopolarity
  • 146,324
  • 131
  • 460
  • 740
2
votes
2 answers

Fixed Point Cholesky Algorithm Advantages

I am developing some code that can get its data from the HW in floating or fixed point. Currently we get that as floating point. The low layer APIs are all in fixed point. So we must pass data back as fixed point. The algorithm we are using is…
user1876942
  • 1,411
  • 2
  • 20
  • 32
2
votes
2 answers

Show a fixed point value in vivado

Let's say I have a fixed point value in my VHDL - Code which is defined as std_logic_vector. I know that my last 4-bit are the decimals. When I use the simulator it will of course not see the last 4 bits as decimals, is there any possibility to…
Kev1n91
  • 3,553
  • 8
  • 46
  • 96