55 struct exp32_sig128 normExpSig;
60 struct uint128 term, altRem, meanRem;
70 signA = signF128UI64( uiA64 );
71 expA = expF128UI64( uiA64 );
72 sigA.v64 = fracF128UI64( uiA64 );
77 expB = expF128UI64( uiB64 );
78 sigB.v64 = fracF128UI64( uiB64 );
82 if ( expA == 0x7FFF ) {
84 (sigA.v64 | sigA.v0) || ((expB == 0x7FFF) && (sigB.v64 | sigB.v0))
90 if ( expB == 0x7FFF ) {
91 if ( sigB.v64 | sigB.v0 )
goto propagateNaN;
97 if ( ! (sigB.v64 | sigB.v0) )
goto invalid;
99 expB = normExpSig.exp;
100 sigB = normExpSig.sig;
103 if ( ! (sigA.v64 | sigA.v0) )
return a;
105 expA = normExpSig.exp;
106 sigA = normExpSig.sig;
110 sigA.v64 |=
UINT64_C( 0x0001000000000000 );
111 sigB.v64 |=
UINT64_C( 0x0001000000000000 );
113 expDiff = expA - expB;
115 if ( expDiff < -1 )
return a;
131 if ( expDiff < 0 )
break;
132 q = (q64 + 0x80000000)>>32;
136 if ( rem.v64 &
UINT64_C( 0x8000000000000000 ) ) {
144 q = (
uint32_t) (q64>>32)>>(~expDiff & 31);
148 if ( rem.v64 &
UINT64_C( 0x8000000000000000 ) ) {
159 }
while ( ! (rem.v64 &
UINT64_C( 0x8000000000000000 )) );
163 (meanRem.v64 &
UINT64_C( 0x8000000000000000 ))
164 || (! (meanRem.v64 | meanRem.v0) && (q & 1))
169 if ( rem.v64 &
UINT64_C( 0x8000000000000000 ) ) {