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

Function decFloatMax

extern/decNumber/decBasic.c:2519–2538  ·  view source on GitHub ↗

------------------------------------------------------------------ */ decFloatMax -- return maxnum of two operands */ / result gets the chosen decFloat */ dfl is the first decFloat (lhs) */ dfr is the second decFloat (rhs) */ set is the context

Source from the content-addressed store, hash-verified

2517/* If just one operand is a quiet NaN it is ignored. */
2518/* ------------------------------------------------------------------ */
2519decFloat * decFloatMax(decFloat *result,
2520 const decFloat *dfl, const decFloat *dfr,
2521 decContext *set) {
2522 Int comp;
2523 if (DFISNAN(dfl)) {
2524 // sNaN or both NaNs leads to normal NaN processing
2525 if (DFISNAN(dfr) || DFISSNAN(dfl)) return decNaNs(result, dfl, dfr, set);
2526 return decCanonical(result, dfr); // RHS is numeric
2527 }
2528 if (DFISNAN(dfr)) {
2529 // sNaN leads to normal NaN processing (both NaN handled above)
2530 if (DFISSNAN(dfr)) return decNaNs(result, dfl, dfr, set);
2531 return decCanonical(result, dfl); // LHS is numeric
2532 }
2533 // Both operands are numeric; numeric comparison needed -- use
2534 // total order for a well-defined choice (and +0 > -0)
2535 comp=decNumCompare(dfl, dfr, 1);
2536 if (comp>=0) return decCanonical(result, dfl);
2537 return decCanonical(result, dfr);
2538 } // decFloatMax
2539
2540/* ------------------------------------------------------------------ */
2541/* decFloatMaxMag -- return maxnummag of two operands */

Callers 1

decFloatMaxMagFunction · 0.85

Calls 3

decCanonicalFunction · 0.85
decNumCompareFunction · 0.85
decNaNsFunction · 0.70

Tested by

no test coverage detected