
From:  Nicholas Patrick 
Subject:  Re: Floating point 
Date:  Wed, 12 May 2021 20:44:07 0500 
Hi Nicholas.
> I've got a bunch of binary data files that contain a mixture of 32 and 64
> bit IEEE 754 floating point values. How can I print the values as a
> formatted decimal?
Poke doesn't support IEEE 754 floatingpoint values as native values.
The idea is to instead have a iee754.pk pickle containing definitions
for the several supported precision FP numbers, and methods and utility
functions to work with them (like printing their value for example.)
Unfortunately no one has written such a pickle yet, but it sounds like a
fun project :)
This could be a start for ieee754.pk:
type IEEE754_S_FP =
struct uint<32>
{
uint<1> sign;
uint<8> exponent;
uint<23> mantissa;
method denormalised_p = int<32>:
{
return exponent == 0 && mantissa != 0;
}
method is_inf = int<32>:
{
return exponent == 0xff && mantissa == 0;
}
method is_nan = int<32>:
{
return (exponent == 1 as uint<8>
&& (sign == 0  mantissa != 1 <<. 22);
}
/* More methods... */
};
[Prev in Thread]  Current Thread  [Next in Thread] 