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

Function decFloatMultiply

extern/decNumber/decBasic.c:2659–2679  ·  view source on GitHub ↗

------------------------------------------------------------------ */ decFloatMultiply -- multiply two decFloats */ / result gets the result of multiplying 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

2657/* */
2658/* ------------------------------------------------------------------ */
2659decFloat * decFloatMultiply(decFloat *result,
2660 const decFloat *dfl, const decFloat *dfr,
2661 decContext *set) {
2662 bcdnum num; // for final conversion
2663 uByte bcdacc[DECPMAX9*18+1]; // for coefficent in BCD
2664
2665 if (DFISSPECIAL(dfl) || DFISSPECIAL(dfr)) { // either is special?
2666 // NaNs are handled as usual
2667 if (DFISNAN(dfl) || DFISNAN(dfr)) return decNaNs(result, dfl, dfr, set);
2668 // infinity times zero is bad
2669 if (DFISINF(dfl) && DFISZERO(dfr)) return decInvalid(result, set);
2670 if (DFISINF(dfr) && DFISZERO(dfl)) return decInvalid(result, set);
2671 // both infinite; return canonical infinity with computed sign
2672 DFWORD(result, 0)=DFWORD(dfl, 0)^DFWORD(dfr, 0); // compute sign
2673 return decInfinity(result, result);
2674 }
2675
2676 /* Here when both operands are finite */
2677 decFiniteMultiply(&num, bcdacc, dfl, dfr);
2678 return decFinalize(result, &num, set); // round, check, and lay out
2679 } // decFloatMultiply
2680
2681/* ------------------------------------------------------------------ */
2682/* decFloatNextMinus -- next towards -Infinity */

Callers

nothing calls this directly

Calls 5

decInvalidFunction · 0.85
decInfinityFunction · 0.85
decFiniteMultiplyFunction · 0.85
decNaNsFunction · 0.70
decFinalizeFunction · 0.70

Tested by

no test coverage detected