On Sun, 27 Sep 2009, Olex P wrote:

Hi guys,

Do we have anything like half precision floats in Haskell? Maybe in some non 
standard
libraries? Or I have to use FFI + OpenEXR library to achieve this?

If you only want to save storage, you may define

newtype Float16 = Float16 Int16

and write Num, Fractional and Floating instances that convert operands to Float, perform operations on Float and put the results back to Int16. By some fusion you may save conversions, but you would also get different results due to higher precision.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to