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
2 answers

Fixed point numbers in C without float

In C is it possible to present a fixed point number in binary form so it can be transmitted without the use floats ? I know how to convert a float or double to the desired fixed point representation but I'm stuck when it shall be done without…
phhe
  • 209
  • 2
  • 9
0
votes
1 answer

Computing square root from fixed point

I have been trying to compute the square root from a fixed point data-type <24,8>.Unfortunately nothing seems to work.Does anyone know how to do this fast and efficient in C(++)?
Alex van Rijs
  • 803
  • 5
  • 17
  • 39
0
votes
1 answer

implementation of isnan() function

I am a beginner to c++ programming and I am given a task of implementation of fixed point math arithmetic in c++. here I am trying to implementation a function isnan() which returns true if the number is not-a-number else will return false. Test…
Dr7
  • 15
  • 3
0
votes
1 answer

How to convert fixed-point VHDL type back to float?

I am using IEEE fixed point package in VHDL. It works well, but I now facing a problem concerning their string representation in a test bench : I would like to dump them in a text file. I have found that it is indeed possible to directly write…
JCLL
  • 5,379
  • 5
  • 44
  • 64
0
votes
1 answer

floating point exception error in fixed point implementation

helo all i implemented a header file for doing the fixedpoint arthimethic operations, which is shown below, it does multiplication and divison operations. #ifndef __fixed_point_header_h__ #define __fixed_point_header_h__ #include…
Rd7
  • 45
  • 2
  • 9
0
votes
1 answer

two namespaces in a .cpp file for a comparison

I am doing fixed point implementation and i am running the test and i am trying to check the precision of my fixedpoint operations with the precision of operations from cmath header. so here is my is code in test.cpp #include…
Rd7
  • 45
  • 2
  • 9
0
votes
1 answer

calculating square root for implementating a fixed point function

i am trying to find the square root of a fixed point and i used the following Calculation to find an approximation of the square root using an integer algorithm. The algorithm is described in Wikipedia: …
Rd7
  • 45
  • 2
  • 9
0
votes
2 answers

Java fixed point arithmetic using byte

I have some values that belong in [-1,1]. I don't need a lot of accuracy but I will need a LOT of those values. Now I'm more of a hardware guy so the solution came to me effortlessly: use fixed point arithmetic. I'm hoping to save memory by using…
capitan
  • 309
  • 4
  • 13
0
votes
2 answers

Fixed point in varius values. uC cortex

i want to multiple values by scale factor on microcontroler, and i cant use float values. For example, once i've got value 170 which is multiply by scale factor ex. 0.00065, so result is 0.1105 and i only need 0.11. I've got values form -500 to…
Matt
  • 11
  • 6
0
votes
2 answers

Numerical Conversion in C/C++

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…
devin
  • 6,407
  • 14
  • 48
  • 53
-1
votes
1 answer

Signed Number Multiplication using Karatsuba Algorithm in Verilog

Tried implementing Karatsuba multiplier for multiplying two binary numbers, the logic below works well for unsigned numbers, but getting incorrect answer when I change one of the inputs to a negative. In the example below a=1010011111000000(equals…
-1
votes
3 answers

How to Convert Fixed Point Number to Decimal Number in Python?

How do I convert a signed 64.64-bit fixed point integer to a decimal number in python? For example the integer 1844674407370955161600 which is a signed 64.64-bit fixed point represents the decimal number +100.00, my understanding is that a python…
MShakeG
  • 391
  • 7
  • 45
-1
votes
1 answer

Why does my filter created with the Matlab Filter Design Tool do not work with fixed point numbers?

I used the Matlab Filter Design tool to create a lowpass filter bank. I exported the bank into a Simulink model. With double precision everything works fine. But if I convert the filter into fixed-point arithmetic with the Filter Design tool, the…
-1
votes
1 answer

How to manually convert between fixed type and floating type?

I am using a library which has fixed point variables.The library is called libfixmath. I am trying to see how a number gets converted from a fix16_t to a float type. I understand it uses 32 bits (16 MSB bits for integers and 16 LSB bits for…
ghostwar 88
  • 547
  • 1
  • 6
  • 17
-1
votes
1 answer

libfixmath undefined reference

I´m trying to produce a little example code for the library libfixmath and I get the error "undefined reference to `fix16_mul' " The code is: #include #include "libfixmath/fixmath.h" int main(){ fix16_t res =…
Sebastian E
  • 467
  • 1
  • 3
  • 15