LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Change sign of fixed point number

Solved!
Go to solution

I know that the first bit in a signed fixed-point number is the sign (0=+, 1=-) but is there an efficient way to invert this sign? It seems like it would be straight forward to just change a 0 to a 1 or a 1 to a 0 but I didn't find any FPGA functions doing this. It feels like overkill to multiply the number by -1. Do I have to somehow convert from fixed point to binary and change the leading bit directly?

 

Thank you for your help!

 

 

0 Kudos
Message 1 of 3
(960 Views)
Solution
Accepted by topic author akarpilow

Hi pilow,

 

have you tried to negate the FXP number?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 3
(957 Views)

Oh damn! That works for fixed point too?  When I saw it I thought it was only for floating point. Well I'm embarrassed now. 😅 Thanks for your help.

0 Kudos
Message 3 of 3
(954 Views)