web123456

c++ Compare Size of Negative Numbers_Mathematical operations of the ratio of the size of the problem, is not it think it is very simple ah!

Common methods of comparing the sizes of several numbers and their principles, from the questions, the median method, the reciprocal method,inequality (math.)The three methods of the method are examined more frequently.

Core knowledge

(1) Differential method

For any two numbers a, b.

If a - b ≥ 0, then a ≥ b; if a - b < 0, then a < b.

(2) Commercial law

When a and b are any two positive numbers, the

as

≥ 1, then a ≥ b; if

< 1, then a < b.

When a and b are any two negative numbers, the

as

≥ 1, then a ≤ b; if

< 1, then a > b.

(3) Intermediate value method

For any two numbers a and b, if an intermediate value c can be found that satisfies a > c and c > b, then a > b can be introduced.

(4) The inverse method

When a and b are of the same sign

as

, then a ≥ b; if

, then a < b.

(5) Inequality method (judgment based on the nature of inequality)

a. If a ≥ b, then a ± c ≥ b ± c;

If a ≥ b and c ≥ d, then a + c ≥ b + d and a - d ≥ b - c;

b. If a > b and c > 0, then ac > bc.

If a > b and c < 0, then ac < bc.

If a > b > 0 and c > d > 0, then ac > bd, and

c. If a > b > 0, then an > bn (n > 1); if a > b > 0, then

(n>1)。

d, when an ≥ bn , n > 0 and n is even.

If a > 0 and b > 0, then a ≥ b > 0;

If a < 0 and b < 0, then a ≤ b < 0.

When an ≥ bn , n > 0 and n is odd, then a ≥ b.

(6) Difference-in-differences comparison method

In general, when comparing the sizes of several fractions, if their values are close to "1" or some integer, then

These fractions can be compared by comparing their difference from "1".