------------------------------------------------------------------ */ decFloatCompare -- compare two decFloats; quiet NaNs allowed */ / result gets the result of comparing dfl and dfr */ dfl is the first decFloat (lhs) */ dfr is the second decFloat (rhs) */ set is the context
| 1675 | /* returns result, which may be -1, 0, 1, or NaN (Unordered) */ |
| 1676 | /* ------------------------------------------------------------------ */ |
| 1677 | decFloat * decFloatCompare(decFloat *result, |
| 1678 | const decFloat *dfl, const decFloat *dfr, |
| 1679 | decContext *set) { |
| 1680 | Int comp; // work |
| 1681 | // NaNs are handled as usual |
| 1682 | if (DFISNAN(dfl) || DFISNAN(dfr)) return decNaNs(result, dfl, dfr, set); |
| 1683 | // numeric comparison needed |
| 1684 | comp=decNumCompare(dfl, dfr, 0); |
| 1685 | decFloatZero(result); |
| 1686 | if (comp==0) return result; |
| 1687 | DFBYTE(result, DECBYTES-1)=0x01; // LSD=1 |
| 1688 | if (comp<0) DFBYTE(result, 0)|=0x80; // set sign bit |
| 1689 | return result; |
| 1690 | } // decFloatCompare |
| 1691 | |
| 1692 | /* ------------------------------------------------------------------ */ |
| 1693 | /* decFloatCompareSignal -- compare two decFloats; all NaNs signal */ |
nothing calls this directly
no test coverage detected