FloatInfo, a tool to explore floating-point representations including IEEE-754 and posits

60 views
Skip to first unread message

Serdar Sanli

unread,
Sep 6, 2023, 8:20:02 AM9/6/23
to Unum Computing
Hello,

I'd like to announce FloatInfo project I published recently, hope it might be helpful to someone. It allows you to modify the value (click on the bits or buttons) and see the decoded format and values. It is currently hosted at this link: https://mserdarsanli.github.io/FloatInfo/

Example screenshot below showing 1+epsilon for 32-bit posit:

FloatInfo.png

Regards,
Serdar Sanli

John Gustafson

unread,
Sep 6, 2023, 7:30:24 PM9/6/23
to Serdar Sanli, Unum Computing
Very cool tool, congratulations!

For the last two years, I've been explaining posits a little differently than in the early papers and presentations. A regime that is all 0 bits represents –∞ (since it is an infinitely long string of 0 bits, since all bits after the LSB have value 0), and then the formula still works because you take 2 to the power of –∞, which is 0.

It also works, almost, for NaR, because a 1 bit followed by all 0 bits will be –(2^∞) = –∞ if you apply the formula, and that's certainly Not-a-Real. We just have to explain the convention that it is also the dumping ground for all other things that are Not-a-Real, like complex numbers, +∞, the entire real number line, the string "zebra", and so on. I think it would be a small edit to show the regime value as –∞ when it is all 0 bits, and still apply the formula. Remember that in comparison operations, NaR tests as less than any other posit, which is what –∞ does.

This explanation also helps explain why a regime consisting of all 1 bits does have a termination bit. It's the implied 0 bit right after the LSB.

I've been using the term "ghost bits" for the infinite string of 0 bits that follows the LSB of a posit.

Best,
John

On Sep 6, 2023, at 5:20 AM, Serdar Sanli <mserda...@gmail.com> wrote:

Hello,

I'd like to announce FloatInfo project I published recently, hope it might be helpful to someone. It allows you to modify the value (click on the bits or buttons) and see the decoded format and values. It is currently hosted at this link: https://mserdarsanli.github.io/FloatInfo/

Example screenshot below showing 1+epsilon for 32-bit posit:

<FloatInfo.png>

Regards,
Serdar Sanli


--
You received this message because you are subscribed to the Google Groups "Unum Computing" group.
To unsubscribe from this group and stop receiving emails from it, send an email to unum-computin...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/unum-computing/32129601-ed31-4297-99f6-b81dbbdf1604n%40googlegroups.com.
<FloatInfo.png>

nickolay.tern

unread,
Sep 6, 2023, 8:03:48 PM9/6/23
to John Gustafson, Serdar Sanli, Unum Computing

Hello colleagues. This is excellent work, thank you for it.

Can you please tell me if support for bfloat16 is expected? If not, is there a possibility to assist you in implementing support for this data format?

Thank you
.
Best regards, Nikolai 


Serdar Sanli

unread,
Sep 6, 2023, 8:49:40 PM9/6/23
to Unum Computing
Thanks for the review, John, glad you've liked it.

Regarding the regime comment, it makes perfect sense and I will do a change to show it as –∞. I just wasn't aware of it.

Regards,
Serdar 

Serdar Sanli

unread,
Sep 6, 2023, 8:53:45 PM9/6/23
to Unum Computing
Hi Nikolai,

Is bfloat16 just same as IEEE-754 floats with different exponent/mantissa sizes? If so it would be trivial change to add that, but I need to be sure if special cases like nans/infs/denormals work the same way before doing the change, and I could not find an authoritative source on that.

Regards,
Serdar

John Gustafson

unread,
Sep 7, 2023, 9:36:26 AM9/7/23
to Serdar Sanli, Unum Computing
Hi Serdar,

No one else seems to have replied, so let me answer. It is super-trivial to support bfloat16 with your tool, since it is simply a 32-bit IEEE 754 float without the least-significant 16 bits. Like a sawed-off shotgun. The exponent bits are unaffected, which is why NaN / Inf / denormals work the same way.

John

Serdar Sanli

unread,
Sep 7, 2023, 12:45:22 PM9/7/23
to John Gustafson, Unum Computing
Thanks for the info,

I've now added bfloat16 and minifloat types, and made the posit regime displayed as -inf when all zeroes.

Regards,
Serdar
Reply all
Reply to author
Forward
0 new messages