forked from haraldwolff/avr-fw-modules
27 lines
408 B
C
Executable File
27 lines
408 B
C
Executable File
#include <fixpoint/fp4816.h>
|
|
|
|
/*
|
|
float fp4816_to_float(fp4816_t value)
|
|
{
|
|
IEEEFLOAT f = { 0.0f };
|
|
int16_t exp = 35;
|
|
uint64_t ui64 = *(uint64_t*)&value;
|
|
|
|
if (ui64 & (0x8000000000000000ULL))
|
|
{
|
|
f.sign = 1;
|
|
ui64 *= -1;
|
|
};
|
|
|
|
while ((ui64) && (!(ui64 & (0x8000000000000000ULL))))
|
|
{
|
|
(ui64) <<= 1;
|
|
exp--;
|
|
};
|
|
|
|
f.mantisse = (ui64 >> 41) & 0x007FFFFFULL;
|
|
f.exponent = exp + 127;
|
|
|
|
return f.f;
|
|
};
|
|
*/ |