Forum Discussion
Altera_Forum
Honored Contributor
15 years agoAbsolute Value and Square Root implementations in fixed point
Hi, I know that there exists a MegaFunction for absolute value in floating point. But I am looking for an implementation to get the absolute value/modulus in fixed point. Another implement...
Altera_Forum
Honored Contributor
15 years agoSmall addition, if still useful.
I guess that if you want the magnitube of a 2's complement number and can accept the error of 1LSB you can simply invert the input number if the MSB is '1'. This will cause an error, though. The advantage is that you don't need an adder. Example: 2's complement | decimal | magnitude | magnitude with error 0000 0 0 0 0001 1 1 1 ... 0111 7 7 7 1000 -8 8 7 1001 -7 7 6 1010 -6 6 5 ... 1111 -1 1 0 Hope it helps