Negative Function

edited 2:38PM in FastReport 3.0
how do I negate an number?

I am memo I put [NOT(4)] and the result is -5
I was especting to get -4

Please comment.

Best regards

Comments

  • edited August 2006
    NOT is a boolean operation.

    signed integer -2 147 483 648...+2 147 483 647

    in hex (negative) 0XFFFFFFFF80000000 (-2 147 483 648) ... 0XFFFFFFFFFFFFFFFF( -1)
    positive 0X0000000000000000(0) .... 0X0000000080000000(+2 147 483 647)

    for example you have 4 (0X0000000000000004), not (4) inverts all bits and you get 0XFFFFFFFFFFFFFFFB (-5).

    in binary:
    0000000000000000000000000000000000000000000000000000000000000100(4)
    inverted
    1111111111111111111111111111111111111111111111111111111111111011(-5)

    I don't know why you especting to get -4 ;)
  • edited 2:38PM
    OK Den thanks for the information, I am learning every day.

    What is the simplest way to get the negative of a positive number or the positive of a negative number?

    eg. 4 to -4 or -4 to 4

    I am currently using this formual (-1)X mutiplyling the number by -1

    (-1)4 = -4 and
    (-1)-4 = 4

    Regards
  • edited 2:38PM
    wrote:
    I am currently using this formual (-1)X mutiplyling the number by -1
    Now you use correct method ;)
  • edited 2:38PM


    All these years have past. I remember when i just started using Fast Reports

Leave a Comment