Home > Back-end >  Learning problems
Learning problems

Time:10-29

- 8% %=5-3, 8-5=3, where is the difference between the two? Trouble points in detail,

CodePudding user response:

Just sent to you, only is % higher priority -, negative number after % is handled as a positive number

CodePudding user response:

1/f, reference and 蘤 old crepe response:
just sent to you, only is % higher priority -, negative number after % was as positive processing

Why is that? Minus sign (-) priority is higher than %, % higher than the priority is a minus sign (-),

CodePudding user response:

refer to the second floor m0_46328473 response:
Quote: 1/f, reference and 蘤 old crepe reply:
just sent to you, only is % higher than the priority -, negative number after % was as positive processing

Why is that? Minus sign (-) priority than %, % higher than the priority is a minus sign (-),


: don't know why, should involve the underlying operations, it's not a question of priorities
That is independent of the two reasons, no causal relationship

CodePudding user response:

First explain the working principle of % : % is a dependent on/operator, the C language standard: with int a, b; Is a strictly equal to (a/b) * b + a % b, that is to say, the result of a % b strictly equal to a - (a/b) * b, then you can explain your example,

- 8% 5=- 3:
(8) % (5)=(3)
=> (8) - (8)/(5) * (5)=(3)

8% - 5=3:
The (8) % (5)=(3)
=> (8) - (8)/(5) * (5)=(3)

CodePudding user response:

reference 4 floor apkipa1 response:
first explain the works: % % is a dependent on/operator, the C language standard: with int a, b; Is a strictly equal to (a/b) * b + a % b, that is to say, the result of a % b strictly equal to a - (a/b) * b, then you can explain your example,

- 8% 5=- 3:
(8) % (5)=(3)
=> (8) - (8)/(5) * (5)=(3)

8% - 5=3:
The (8) % (5)=(3)
=> (8) - (8)/(5)) * (5)=(3)

You also have ah, established - 8% - 3=3 also, online search less than you to this definition? How do you know?

CodePudding user response:

references and 蘤 old crepe reply: 3/f
Quote: refer to the second floor m0_46328473 response:

Quote: 1/f, references and 蘤 old crepe reply:
just sent to you, only is % higher priority -, negative number after % was as positive processing

Why is that? Minus sign (-) priority than %, % higher than the priority is a minus sign (-),


: don't know why, should involve the underlying operations, it's not a question of priorities
That is independent of the two reasons, there is no causal relationship between

I see what you mean, you that is right, I can understand that, but I think the notion of May 4th floor is better, and a % b=a - (a/b) * b, this formula is set up to all situations,

CodePudding user response:

refer to 6th floor m0_46328473 response:
Quote: refer to the third floor and 蘤 old crepe reply:
Quote: refer to the second floor m0_46328473 response:

Quote: 1/f, references and 蘤 old crepe reply:
just sent to you, only is % higher priority -, negative number after % was as positive processing

Why is that? Minus sign (-) priority than %, % higher than the priority is a minus sign (-),


: don't know why, should involve the underlying operations, it's not a question of priorities
That is independent of the two reasons, there is no causal relationship between

I see what you mean, you that is right, I can understand that, but I think the notion of May 4th floor is better, and a % b=a - (a/b) * b, this formula established in all cases,

I also think that explain more professional, learn

CodePudding user response:

reference 5 floor m0_46328473 reply:
do you still really ah, this established - 8% - 3=3 also, online search less than you to this definition? How do you know?

As I've said, it comes from the C language standard, is the official organization released, I refer to is C11 standard, corresponding to the draft, http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf, of course, the draft and the actual will have little difference, if interested, can consider to pay to support the original

CodePudding user response:

refer to the second floor m0_46328473 response:
Quote: 1/f, reference and 蘤 old crepe reply:
just sent to you, only is % higher than the priority -, negative number after % was as positive processing

Why is that? Minus sign (-) priority than %, % higher than the priority is a minus sign (-),

This is rules, no why. Suggest check C language symbol priority

CodePudding user response:

Pray over the last at the end of the day is called assemblers div/idiv
IDIV instructions signed division

Format: IDIV SRC

Do: same as the DIV, but the operands must be signed, quotient and the remainder are also signed, and the remainder of the symbol is the same as the dividend of symbols
  • Related