Thread: convert negative float to positive ???

  1. #1
    Registered User
    Join Date
    Jun 2006
    Posts
    21

    convert negative float to positive ???

    Hello all,

    How do I convert a negative float to a positive float?

    Cheers,

    Manny

  2. #2
    Registered User SKeane's Avatar
    Join Date
    Sep 2006
    Location
    England
    Posts
    234
    * -1.0 ? Or possibly fabs() depending upon what it is you are actually trying to do.

  3. #3
    Registered User
    Join Date
    Jun 2006
    Posts
    21
    Quote Originally Posted by SKeane
    * -1.0 ? Or possibly fabs() depending upon what it is you are actually trying to do.
    Great.... *-1 does the trick.

    ta.

  4. #4
    Registered User OnionKnight's Avatar
    Join Date
    Jan 2005
    Posts
    555
    Why not just use the unary - operator instead? Multiplying by -1 in programming is an artifact of mathematics in my eyes.

  5. #5
    Registered User
    Join Date
    Mar 2008
    Posts
    6
    Quote Originally Posted by SKeane View Post
    * -1.0 ? Or possibly fabs() depending upon what it is you are actually trying to do.
    I am searching and trying to do this for nearly 5 hours and your post has made me do it. Thank you a lot =)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 05-13-2009, 03:25 PM
  2. Promblem with code
    By watchdogger in forum C Programming
    Replies: 18
    Last Post: 01-31-2009, 06:36 PM
  3. Opengl walking leg animation
    By Bobby230 in forum C Programming
    Replies: 3
    Last Post: 03-05-2006, 03:41 PM
  4. Display list not displaying?
    By psychopath in forum Game Programming
    Replies: 5
    Last Post: 09-19-2004, 06:47 PM
  5. how to handle integer overflow in C
    By kate1234 in forum C Programming
    Replies: 8
    Last Post: 04-23-2003, 12:20 PM