Yarn icon indicating copy to clipboard operation
Yarn copied to clipboard

Adding support for ieee754 32 bits floating-point instructions ?

Open matovitch opened this issue 8 years ago • 2 comments

Having support for 32 bit floating-point arithmetic would be great. :-)

matovitch avatar Mar 04 '16 14:03 matovitch

I am open to discussing it, however this is design choice I intentionally made. I decided that if I wanted fractional numbers I could use fixed point arithmetic.

When I was looking into adding types (originally it was all signed int32s) I had a list of types I wanted:

  • uint32
  • int32
  • char
  • uchar
  • float32

I then started thinking about it, realized I didn't really need to add suppot for char operations, especially since I only had 32 bit registers and it would be a bit convoluted and unnecessary to add. The float32 was different, and I wasn't sure how I wanted to do it. I then stumbled across the idea of doing all fixed point math, and realized thats how I wanted to do it, and didn't require adding any new operations.

So I guess my question is, aside from the obvious advantages, how would Yarn benefit from floating point rather than using fixed point ints?

WetDesertRock avatar Mar 04 '16 15:03 WetDesertRock

Thanks for your quick response. The issue I see with fixed point representation, is that you have to keep track of the scaling factor when you divide or multiply. I thought it wouldn't be a lot harder than integer arithmetic, but I did not look at the way it works (at least for now) and you know much better than I do.

matovitch avatar Mar 04 '16 17:03 matovitch