Cmp compares the numbers represented by d and d2 and returns: -1 if d < d2 0 if d == d2 +1 if d > d2
(d2 Decimal)
| 1298 | // 0 if d == d2 |
| 1299 | // +1 if d > d2 |
| 1300 | func (d Decimal) Cmp(d2 Decimal) int { |
| 1301 | d.ensureInitialized() |
| 1302 | d2.ensureInitialized() |
| 1303 | |
| 1304 | if d.exp == d2.exp { |
| 1305 | return d.value.Cmp(d2.value) |
| 1306 | } |
| 1307 | |
| 1308 | rd, rd2 := RescalePair(d, d2) |
| 1309 | |
| 1310 | return rd.value.Cmp(rd2.value) |
| 1311 | } |
| 1312 | |
| 1313 | // Compare compares the numbers represented by d and d2 and returns: |
| 1314 | // |