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

Go to the source code of this file.

Functions

float64_t f16_to_f64 (float16_t a)
 

Function Documentation

◆ f16_to_f64()

float64_t f16_to_f64 ( float16_t a)

Definition at line 44 of file f16_to_f64.c.

45{
46 union ui16_f16 uA;
47 uint_fast16_t uiA;
48 bool sign;
49 int_fast8_t exp;
50 uint_fast16_t frac;
51 struct commonNaN commonNaN;
52 uint_fast64_t uiZ;
53 struct exp8_sig16 normExpSig;
54 union ui64_f64 uZ;
55
56 /*------------------------------------------------------------------------
57 *------------------------------------------------------------------------*/
58 uA.f = a;
59 uiA = uA.ui;
60 sign = signF16UI( uiA );
61 exp = expF16UI( uiA );
62 frac = fracF16UI( uiA );
63 /*------------------------------------------------------------------------
64 *------------------------------------------------------------------------*/
65 if ( exp == 0x1F ) {
66 if ( frac ) {
69 } else {
70 uiZ = packToF64UI( sign, 0x7FF, 0 );
71 }
72 goto uiZ;
73 }
74 /*------------------------------------------------------------------------
75 *------------------------------------------------------------------------*/
76 if ( ! exp ) {
77 if ( ! frac ) {
78 uiZ = packToF64UI( sign, 0, 0 );
79 goto uiZ;
80 }
81 normExpSig = softfloat_normSubnormalF16Sig( frac );
82 exp = normExpSig.exp - 1;
83 frac = normExpSig.sig;
84 }
85 /*------------------------------------------------------------------------
86 *------------------------------------------------------------------------*/
87 uiZ = packToF64UI( sign, exp + 0x3F0, (uint_fast64_t) frac<<42 );
88 uiZ:
89 uZ.ui = uiZ;
90 return uZ.f;
91
92}
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181
#define softfloat_f16UIToCommonNaN(uiA, zPtr)
Definition specialize.h:96
#define softfloat_commonNaNToF64UI(aPtr)
Definition specialize.h:172
#define expF16UI(a)
Definition internals.h:84
#define signF16UI(a)
Definition internals.h:83
#define fracF16UI(a)
Definition internals.h:85
struct exp8_sig16 softfloat_normSubnormalF16Sig(uint_fast16_t)
#define packToF64UI(sign, exp, sig)
Definition internals.h:128
uint16_t uint_fast16_t
Definition stdint.h:155
uint64_t uint_fast64_t
Definition stdint.h:157
int8_t int_fast8_t
Definition stdint.h:150
float64_t f
Definition internals.h:47
Here is the call graph for this function: