How can I change the sign of an Integer value like 100 to -100 ?

Discussion in 'ASP .Net' started by Andreas Klemt, Jul 28, 2003.

  1. Hello,
    how can I change the sign of an Integer Value like

    Abs?(100)
    -> -100

    Thanks,
    Andreas
    Andreas Klemt, Jul 28, 2003
    #1
    1. Advertising

  2. Andreas Klemt

    Karl Seguin Guest

    multiple by -1 will always toggle the sign...

    -1 * 40 = -40
    -1 * -40 = 40

    abs() will always make something positive

    abs(40) = 40
    abs(-40) = 40

    abs() * -1 will always make it negative

    abs(40) * -1 = -40
    abs(-40) * -1 = 40

    (abs is defined in system.math)

    karl

    "Andreas Klemt" <> wrote in message
    news:e%...
    > Hello,
    > how can I change the sign of an Integer Value like
    >
    > Abs?(100)
    > -> -100
    >
    > Thanks,
    > Andreas
    >
    >
    Karl Seguin, Jul 28, 2003
    #2
    1. Advertising

  3. Andreas Klemt

    Marina Guest

    Multiply it by -1.

    "Andreas Klemt" <> wrote in message
    news:e%...
    > Hello,
    > how can I change the sign of an Integer Value like
    >
    > Abs?(100)
    > -> -100
    >
    > Thanks,
    > Andreas
    >
    >
    Marina, Jul 28, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jimmy
    Replies:
    1
    Views:
    931
    Cowboy \(Gregory A. Beamer\)
    Nov 21, 2006
  2. Abhishek
    Replies:
    12
    Views:
    803
    Eric Sosman
    Jan 30, 2006
  3. Replies:
    7
    Views:
    177
    Tad McClellan
    Jun 22, 2006
  4. fred
    Replies:
    3
    Views:
    273
    Zifud
    Mar 17, 2005
  5. Replies:
    5
    Views:
    880
Loading...

Share This Page