Hacker News Viewer

Floating point from scratch: Hard Mode

by random__duck on 4/4/2026, 5:53:40 PM

https://essenceia.github.io/projects/floating_dragon/

Comments

by: saagarjha

I think the thing that truly scares me about floating point is not IEEE-754 or even the weird custom floating points that people come up with but the horrible, horrible things that some people think passes for a floating point implementation in hardware, who think that things like infinities or precision in the last place are kind of overrated.

4/7/2026, 12:18:16 PM


by: Neywiny

I had to do an FP8 adder as my final project for my FPGA lab. It was at least a full page of state machine. And I write small. I ended up just not doing the rounding and truncating instead because I was so done with it.<p>Consider me educated on the mantissa. That&#x27;s a nifty pedantry.<p>Typo in the c++?<p>&gt; cout &lt;&lt; &quot;x =&#x2F;= x: &quot; &lt;&lt; ((x=x) ? &quot;true&quot; : &quot;false&quot;) &lt;&lt; endl;<p>Should be x != x?<p>For the leading 0 counter, I&#x27;ve found it&#x27;s even better for the tool if I use a for loop. Keeps things scalable and it&#x27;s even less code. I&#x27;m not understanding this takeaway though<p>&gt; Sometimes a good design is about more than just performance.<p>The good design (unless the author&#x27;s note that it&#x27;s easier to read and maintain makes it worse design?) was better performing. So sometimes a good design creates performance.<p>Likewise for pipelining: it would have been interesting to know if the tools can reorder operations if you give them some pipeline registers to play with. In Xilinx land it&#x27;ll move your logic around and utilize the flops as it sees fit.

4/7/2026, 12:29:27 PM


by: Taniwha

Everyone who has ever had to build a floating point unit has hated it with a passion, I&#x27;ve watched in done from afar, and done it myself

4/7/2026, 11:06:13 AM