MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / decFloatCompareSignal

Function decFloatCompareSignal

extern/decNumber/decBasic.c:1701–1717  ·  view source on GitHub ↗

------------------------------------------------------------------ */ decFloatCompareSignal -- compare two decFloats; all NaNs signal */ / 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

Source from the content-addressed store, hash-verified

1699/* returns result, which may be -1, 0, 1, or NaN (Unordered) */
1700/* ------------------------------------------------------------------ */
1701decFloat * decFloatCompareSignal(decFloat *result,
1702 const decFloat *dfl, const decFloat *dfr,
1703 decContext *set) {
1704 Int comp; // work
1705 // NaNs are handled as usual, except that all NaNs signal
1706 if (DFISNAN(dfl) || DFISNAN(dfr)) {
1707 set->status|=DEC_Invalid_operation;
1708 return decNaNs(result, dfl, dfr, set);
1709 }
1710 // numeric comparison needed
1711 comp=decNumCompare(dfl, dfr, 0);
1712 decFloatZero(result);
1713 if (comp==0) return result;
1714 DFBYTE(result, DECBYTES-1)=0x01; // LSD=1
1715 if (comp<0) DFBYTE(result, 0)|=0x80; // set sign bit
1716 return result;
1717 } // decFloatCompareSignal
1718
1719/* ------------------------------------------------------------------ */
1720/* decFloatCompareTotal -- compare two decFloats with total ordering */

Callers

nothing calls this directly

Calls 3

decNumCompareFunction · 0.85
decFloatZeroFunction · 0.85
decNaNsFunction · 0.70

Tested by

no test coverage detected