08-21-2015 08:44 AM
Is there anybody who used the Integer to Fix Point cast for a 2`s complement so far?
I've seen a lot of solution way more complicated than this one in the forum even from LabVIEW greats. It's especially great for fractional values (decimal)
What do you think?
08-21-2015 10:50 AM - edited 08-21-2015 01:51 PM
If you are just throwing out sentence fragments without much context, at least provide some links to the "solutions by LabVIEW greats" that you mention. Also tell us why you think they are complicated and how you suggest to simplify them.
What is "great for fractional values (decimal)"? (fixed point itself? 2s complement?, etc.) Fixed point is quantized to the binary resolution, so they are not that great for decimal fractions.
@Maloya wrote:
What do you think?
I think I have another coffee. 😄
08-22-2015 06:25 PM
Given enough bits for the decimal, fixed point can handle them pretty well.
Here's the problem the OP is likely running into: maintaining the decimal values from fixed point means you're going to need to work with a floating point of some sort. These are never twos complement. That's a system strictly for integer types. Floating point is broken into three sections: sign, exponent offset, and mantissa. You'll need to convert your fixed point data into this format. This is likely why you're finding the code to do so complicated.