Hi, I have a problem with representing a negative number, like -0.91 using fixed point math?

I read the tutorial for the fixed point math from http://www.embedded.com/columns/15201575?_requestid=4559 but didn't understand how to do that.

I need to represent numbers from -1:1 with step 0.0001.

Then I use 2 bits for signed integer and 14 bits for fractional.

typedef union FIXED2_14tag{ S16 full; struct part2_14tag{ U16 fraction: 14; S16 integer: 2; }part; }FIXED2_14;

U-unsigned, S-signed

and from modified his example:

#define FIXED2_14CONST(A,B) (S16)((A<<14)+( (A<0 ? (B-0.000030517578125):(B+0.000030517578125))*16384 ))

This works ok for number -1.9999 to -1.0000 and from 0 to 1.9999, but can't represent number from -0.9999 to -0.0001

I know the problem is in the next statement:

(A<0 ? ...

because A can be 1,0 or -1 and what if I have the number -0.34 ?

In this case A is -0 and have a problem, I'm getting positive number (0.34), how to solve this problem?