------------------------------------------------------------------ */ decFloatMin -- return minnum of two operands */ / result gets the chosen decFloat */ dfl is the first decFloat (lhs) */ dfr is the second decFloat (rhs) */ set is the context
| 2576 | /* If just one operand is a quiet NaN it is ignored. */ |
| 2577 | /* ------------------------------------------------------------------ */ |
| 2578 | decFloat * decFloatMin(decFloat *result, |
| 2579 | const decFloat *dfl, const decFloat *dfr, |
| 2580 | decContext *set) { |
| 2581 | Int comp; |
| 2582 | if (DFISNAN(dfl)) { |
| 2583 | // sNaN or both NaNs leads to normal NaN processing |
| 2584 | if (DFISNAN(dfr) || DFISSNAN(dfl)) return decNaNs(result, dfl, dfr, set); |
| 2585 | return decCanonical(result, dfr); // RHS is numeric |
| 2586 | } |
| 2587 | if (DFISNAN(dfr)) { |
| 2588 | // sNaN leads to normal NaN processing (both NaN handled above) |
| 2589 | if (DFISSNAN(dfr)) return decNaNs(result, dfl, dfr, set); |
| 2590 | return decCanonical(result, dfl); // LHS is numeric |
| 2591 | } |
| 2592 | // Both operands are numeric; numeric comparison needed -- use |
| 2593 | // total order for a well-defined choice (and +0 > -0) |
| 2594 | comp=decNumCompare(dfl, dfr, 1); |
| 2595 | if (comp<=0) return decCanonical(result, dfl); |
| 2596 | return decCanonical(result, dfr); |
| 2597 | } // decFloatMin |
| 2598 | |
| 2599 | /* ------------------------------------------------------------------ */ |
| 2600 | /* decFloatMinMag -- return minnummag of two operands */ |
no test coverage detected