Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
s_subMagsF64.c File Reference
#include <stdbool.h>
#include <stdint.h>
#include "platform.h"
#include "internals.h"
#include "specialize.h"
#include "softfloat.h"
Include dependency graph for s_subMagsF64.c:

Go to the source code of this file.

Functions

float64_t softfloat_subMagsF64 (uint_fast64_t uiA, uint_fast64_t uiB, bool signZ)
 

Function Documentation

◆ softfloat_subMagsF64()

float64_t softfloat_subMagsF64 ( uint_fast64_t uiA,
uint_fast64_t uiB,
bool signZ )

Definition at line 45 of file s_subMagsF64.c.

46{
47 int_fast16_t expA;
48 uint_fast64_t sigA;
49 int_fast16_t expB;
50 uint_fast64_t sigB;
51 int_fast16_t expDiff;
52 uint_fast64_t uiZ;
53 int_fast64_t sigDiff;
54 int_fast8_t shiftDist;
55 int_fast16_t expZ;
56 uint_fast64_t sigZ;
57 union ui64_f64 uZ;
58
59 /*------------------------------------------------------------------------
60 *------------------------------------------------------------------------*/
61 expA = expF64UI( uiA );
62 sigA = fracF64UI( uiA );
63 expB = expF64UI( uiB );
64 sigB = fracF64UI( uiB );
65 /*------------------------------------------------------------------------
66 *------------------------------------------------------------------------*/
67 expDiff = expA - expB;
68 if ( ! expDiff ) {
69 /*--------------------------------------------------------------------
70 *--------------------------------------------------------------------*/
71 if ( expA == 0x7FF ) {
72 if ( sigA | sigB ) goto propagateNaN;
74 uiZ = defaultNaNF64UI;
75 goto uiZ;
76 }
77 sigDiff = sigA - sigB;
78 if ( ! sigDiff ) {
79 uiZ =
82 goto uiZ;
83 }
84 if ( expA ) --expA;
85 if ( sigDiff < 0 ) {
86 signZ = ! signZ;
87 sigDiff = -sigDiff;
88 }
89 shiftDist = softfloat_countLeadingZeros64( sigDiff ) - 11;
90 expZ = expA - shiftDist;
91 if ( expZ < 0 ) {
92 shiftDist = expA;
93 expZ = 0;
94 }
95 uiZ = packToF64UI( signZ, expZ, sigDiff<<shiftDist );
96 goto uiZ;
97 } else {
98 /*--------------------------------------------------------------------
99 *--------------------------------------------------------------------*/
100 sigA <<= 10;
101 sigB <<= 10;
102 if ( expDiff < 0 ) {
103 /*----------------------------------------------------------------
104 *----------------------------------------------------------------*/
105 signZ = ! signZ;
106 if ( expB == 0x7FF ) {
107 if ( sigB ) goto propagateNaN;
108 uiZ = packToF64UI( signZ, 0x7FF, 0 );
109 goto uiZ;
110 }
111 sigA += expA ? UINT64_C( 0x4000000000000000 ) : sigA;
112 sigA = softfloat_shiftRightJam64( sigA, -expDiff );
113 sigB |= UINT64_C( 0x4000000000000000 );
114 expZ = expB;
115 sigZ = sigB - sigA;
116 } else {
117 /*----------------------------------------------------------------
118 *----------------------------------------------------------------*/
119 if ( expA == 0x7FF ) {
120 if ( sigA ) goto propagateNaN;
121 uiZ = uiA;
122 goto uiZ;
123 }
124 sigB += expB ? UINT64_C( 0x4000000000000000 ) : sigB;
125 sigB = softfloat_shiftRightJam64( sigB, expDiff );
126 sigA |= UINT64_C( 0x4000000000000000 );
127 expZ = expA;
128 sigZ = sigA - sigB;
129 }
130 return softfloat_normRoundPackToF64( signZ, expZ - 1, sigZ );
131 }
132 /*------------------------------------------------------------------------
133 *------------------------------------------------------------------------*/
134 propagateNaN:
135 uiZ = softfloat_propagateNaNF64UI( uiA, uiB );
136 uiZ:
137 uZ.ui = uiZ;
138 return uZ.f;
139
140}
uint_fast64_t softfloat_propagateNaNF64UI(uint_fast64_t uiA, uint_fast64_t uiB)
void softfloat_raiseFlags(uint_fast8_t flags)
#define defaultNaNF64UI
Definition specialize.h:158
float64_t softfloat_normRoundPackToF64(bool, int_fast16_t, uint_fast64_t)
#define packToF64UI(sign, exp, sig)
Definition internals.h:128
#define expF64UI(a)
Definition internals.h:126
#define fracF64UI(a)
Definition internals.h:127
uint64_t softfloat_shiftRightJam64(uint64_t a, uint_fast32_t dist)
THREAD_LOCAL uint_fast8_t softfloat_roundingMode
@ softfloat_flag_invalid
Definition softfloat.h:89
@ softfloat_round_min
Definition softfloat.h:74
#define softfloat_countLeadingZeros64
uint64_t uint_fast64_t
Definition stdint.h:157
int8_t int_fast8_t
Definition stdint.h:150
#define UINT64_C(val)
Definition stdint.h:284
int16_t int_fast16_t
Definition stdint.h:151
int64_t int_fast64_t
Definition stdint.h:153
Here is the call graph for this function:
Here is the caller graph for this function: