PositX1 conversion
milankl opened this issue · 8 comments
Unfortunately, the PositX1 format (with 1 exponent bit, internally stored as 32bit) has poor conversion support. Posit8_1(Posit32(1.23))
causes an error for example.
The problem is that p32_to_pX1.o
isn't built in the Makefile
, probably because p32_to_pX1.c
is broken
I'll ask Cerlane about that. Weird that she uploads the .c file still...
Probably it would be sufficient to define a couple of types, just like what is done for p32_to_pX2.c
- Float64.(Posit8_1(0x0)) is not supported yet. Is that right?
Yes, that's right. I've implemented the function already but currently it tries to call a C function from the SoftPosit C library that doesn't exist yet. Float64(Posit8(0x00))
, or Float64(Posit8_2(0x00))
should work though.
Thanks. Float64(Posit8_2(0x00)) helps. What about FloatXX(Posit16X(0x00))? It seems none of the Posit16 can be cast to Float for the time being. Is there any workaround possible?
Please note that for 16bit formats you need to use UInt16
and not UInt8
(also when encoded as hexadecimal), i.e.
julia> Float64(Posit16_2(0x5000))
4.0
julia> Float64(Posit16(0x5000))
2.0
This is briefly explained in the first section of the notebook that I've uploaded for the docs.
Given the independence of upcoming v0.5 with C-SoftPosit this issue is no longer relevant