Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
f64_to_f128.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 f64_to_f128.c:

Go to the source code of this file.

Functions

float128_t f64_to_f128 (float64_t a)
 

Function Documentation

◆ f64_to_f128()

float128_t f64_to_f128 ( float64_t a)

Definition at line 44 of file f64_to_f128.c.

45{
46 union ui64_f64 uA;
47 uint_fast64_t uiA;
48 bool sign;
49 int_fast16_t exp;
50 uint_fast64_t frac;
51 struct commonNaN commonNaN;
52 struct uint128 uiZ;
53 struct exp16_sig64 normExpSig;
54 struct uint128 frac128;
55 union ui128_f128 uZ;
56
57 /*------------------------------------------------------------------------
58 *------------------------------------------------------------------------*/
59 uA.f = a;
60 uiA = uA.ui;
61 sign = signF64UI( uiA );
62 exp = expF64UI( uiA );
63 frac = fracF64UI( uiA );
64 /*------------------------------------------------------------------------
65 *------------------------------------------------------------------------*/
66 if ( exp == 0x7FF ) {
67 if ( frac ) {
70 } else {
71 uiZ.v64 = packToF128UI64( sign, 0x7FFF, 0 );
72 uiZ.v0 = 0;
73 }
74 goto uiZ;
75 }
76 /*------------------------------------------------------------------------
77 *------------------------------------------------------------------------*/
78 if ( ! exp ) {
79 if ( ! frac ) {
80 uiZ.v64 = packToF128UI64( sign, 0, 0 );
81 uiZ.v0 = 0;
82 goto uiZ;
83 }
84 normExpSig = softfloat_normSubnormalF64Sig( frac );
85 exp = normExpSig.exp - 1;
86 frac = normExpSig.sig;
87 }
88 /*------------------------------------------------------------------------
89 *------------------------------------------------------------------------*/
90 frac128 = softfloat_shortShiftLeft128( 0, frac, 60 );
91 uiZ.v64 = packToF128UI64( sign, exp + 0x3C00, frac128.v64 );
92 uiZ.v0 = frac128.v0;
93 uiZ:
94 uZ.ui = uiZ;
95 return uZ.f;
96
97}
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181
#define softfloat_commonNaNToF128UI
#define softfloat_f64UIToCommonNaN(uiA, zPtr)
Definition specialize.h:166
struct exp16_sig64 softfloat_normSubnormalF64Sig(uint_fast64_t)
#define signF64UI(a)
Definition internals.h:125
#define expF64UI(a)
Definition internals.h:126
#define fracF64UI(a)
Definition internals.h:127
struct uint128 softfloat_shortShiftLeft128(uint64_t a64, uint64_t a0, uint_fast8_t dist)
uint64_t uint_fast64_t
Definition stdint.h:157
int16_t int_fast16_t
Definition stdint.h:151
Here is the call graph for this function: