This commit is contained in:
2025-05-28 14:41:02 -05:00
commit 6d366537dd
73 changed files with 4448 additions and 0 deletions

26
lib/math/software_float.c Normal file
View File

@ -0,0 +1,26 @@
#include <math/software_float.h>
/* A float = FLOAT_SIGN * FLOAT_MANTISSA * (2 ^ FLOAT_EXPONENT) */
soft_float32_t decode_float(uint32_t raw)
{
soft_float32_t f;
f.sign = (raw >> 31) & 1;
f.exponent = (raw >> 23) & 0xFF;
f.mantissa = raw & 0x7FFFFF;
return f;
}
soft_float64_t decode_double(uint64_t raw)
{
soft_float64_t d;
d.sign = (raw >> 63) & 1;
d.exponent = (raw >> 52) & 0x7FF;
d.mantissa = raw & 0xFFFFFFFFFFFFF;
return d;
}