Thread: oppostie order 0 - 127

  1. #16
    misoturbutc Hodor's Avatar
    Join Date
    Nov 2013
    Posts
    1,787
    Quote Originally Posted by brownt View Post
    hmm that's disappointing. I am not here for jokes and if I wanted to work something out myself, I would not consult a forum. In someway it might seem fair enough to act like a teacher and provide hints etc. But that impedes people that are trying to get to the facts as quickly as possible.

    Being a signed integer, the answer is in fact subtract 127 and then multiply by -1.
    if it was an unsigned char, a one's complement would do.

    Thanks for your well intended, but unhelpful answers.
    Please explain how the answer is incorrect; i.e. if you input is the variable 'n' then how is 127 - n not a correct answer?

    Now let's look at your answer: (n - 127) * -1
    We'll do some simple mathematical stuff to that and rearrange the equation
    (n - 127) * -1
    = -(n - 127)
    = -n + 127
    = 127 - n


    :-o Wow, we can now do it with an unsigned type just like we did almost 24 hours ago and it's mathematically the same and it does it with just one subtraction and not need a multiply and doesn't needs 1s complement.

    Perhaps you should re-read the earlier answers and see that they are not a joke at all.

    (You owe some people an apology as well. Thanks)

    Edit: As an exercise I'll leave it to you to explain how my alternative answer of 0x7f XOR n works
    Last edited by Hodor; 02-19-2018 at 09:35 PM.

  2. #17
    Registered User
    Join Date
    Jan 2018
    Posts
    10
    Quote Originally Posted by Hodor View Post
    Please explain how the answer is incorrect; i.e. if you input is the variable 'n' then how is 127 - n not a correct answer?

    Now let's look at your answer: (n - 127) * -1
    We'll do some simple mathematical stuff to that and rearrange the equation
    (n - 127) * -1
    = -(n - 127)
    = -n + 127
    = 127 - n


    :-o Wow, we can now do it with an unsigned type just like we did almost 24 hours ago and it's mathematically the same and it does it with just one subtraction and not need a multiply and doesn't needs 1s complement.

    Perhaps you should re-read the earlier answers and see that they are not a joke at all.

    (You owe some people an apology as well. Thanks)

    Edit: As an exercise I'll leave it to you to explain how my alternative answer of 0x7f XOR n works
    127 - n, right you are thanks.

    Apology? Had you have answered the question to begin with, with a simple // 127 -n // there would have only been one reply. But instead you chose to play the role of a teacher, suggesting that here is some info, now work it out. Then you put up a hard to understand conditional for loop, and then a ridiculous set of 'if else' statements. That attempt at humour, which only led to my frustration, subsequently led someone else to put up a lookup table.

    None of the answers were able to help me. I had to work it out myself.

    and so I thanked people for there help.

    "as an exercise I'll leave it to you ....."

    Take a look at yourself. Not everyone is like you. Time is of the essence for me, I have no times for games or frankly, anymore of this ......

    thanks for your answer.

  3. #18
    misoturbutc Hodor's Avatar
    Join Date
    Nov 2013
    Posts
    1,787
    Quote Originally Posted by brownt View Post
    127 - n, right you are thanks.

    Apology? Had you have answered the question to begin with, with a simple // 127 -n // there would have only been one reply. But instead you chose to play the role of a teacher, suggesting that here is some info, now work it out. Then you put up a hard to understand conditional for loop, and then a ridiculous set of 'if else' statements. That attempt at humour, which only led to my frustration, subsequently led someone else to put up a lookup table.

    None of the answers were able to help me. I had to work it out myself.

    and so I thanked people for there help.

    "as an exercise I'll leave it to you ....."

    Take a look at yourself. Not everyone is like you. Time is of the essence for me, I have no times for games or frankly, anymore of this ......

    thanks for your answer.
    The loop was there to simply demonstrate what the program output for each value of 0 to 127 *shrug* If you'd spent 6 seconds reading the program maybe you would have seen that and also that you had the answer a day ago

  4. #19
    misoturbutc Hodor's Avatar
    Join Date
    Nov 2013
    Posts
    1,787
    Quote Originally Posted by brownt View Post

    "as an exercise I'll leave it to you ....."

    Take a look at yourself. Not everyone is like you. Time is of the essence for me, I have no times for games or frankly, anymore of this ......

    thanks for your answer.
    I don't have to take a look at it. I wrote it so I think I understand it.

    Anyway, it's obvious you don't want to learn programming so don't expect any more answers or even nudges in the right direction.

  5. #20
    Registered User
    Join Date
    Jan 2018
    Posts
    10
    correct, I don't want to learn programming at this time. I know what I know and any further learning will have to wait, until I have time. I had a deadline, and what I needed was answers, not some riddle or joking about.

    I didn't ask you to look at it, i asked you to have a look at yourself. because we are not all like you and so you cannot expect everyone to be on the same path, or even to me able to interpret someone else's attempt at humour.

  6. #21
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,662
    Similarly, we're not here for your convenience to help you pass exams with minimal effort.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  7. #22
    misoturbutc Hodor's Avatar
    Join Date
    Nov 2013
    Posts
    1,787
    Quote Originally Posted by brownt View Post
    correct, I don't want to learn programming at this time. I know what I know and any further learning will have to wait, until I have time. I had a deadline, and what I needed was answers, not some riddle or joking about.

    I didn't ask you to look at it, i asked you to have a look at yourself. because we are not all like you and so you cannot expect everyone to be on the same path, or even to me able to interpret someone else's attempt at humour.
    There was no joke. It's not my fault if you cannot understand
    Code:
    for (i = 0; i < 128; i++) {}
    and/or think it's a cryptic loop. Perhaps if you think that's a complicated loop or a joke you should be failing whatever it is you're doing.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Value order
    By danzis in forum C Programming
    Replies: 18
    Last Post: 01-09-2018, 04:53 PM
  2. Replies: 9
    Last Post: 04-01-2011, 04:13 PM
  3. Replies: 4
    Last Post: 03-06-2008, 03:38 PM
  4. what is the significance of low order and high order bits
    By Shadow12345 in forum Windows Programming
    Replies: 1
    Last Post: 11-16-2002, 11:46 AM

Tags for this Thread