KC | 1 Mar 07:09 2014
Picon

Can Haskell use short floats; i.e. 16 bit floats to save space?

Can Haskell use short floats; i.e. 16 bit floats to save space?

--

--

Sent from an expensive device which will be obsolete in a few months! :D

Casey

_______________________________________________
Haskell mailing list
Haskell <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell
Henning Thielemann | 1 Mar 07:47 2014
Picon

Re: [Haskell] Can Haskell use short floats; i.e. 16 bit floats to save space?

moving to Haskell-Cafe ...

Am 01.03.2014 07:09, schrieb KC:
> Can Haskell use short floats; i.e. 16 bit floats to save space?

You could wrap an Int16 in a newtype and implement your own floating 
point arithmetic with some bit manipulation and make that instances of 
Num, Fractional or numeric-prelude or yap classes.
Johan Tibell | 1 Mar 08:56 2014
Picon

Re: [Haskell] Can Haskell use short floats; i.e. 16 bit floats to save space?

Am 01.03.2014 07:09, schrieb KC:

Can Haskell use short floats; i.e. 16 bit floats to save space?

GHC pads all basic data types to one word in its in-memory representation, so no. It's possible that the boxed vectors in the "vector" package has a more compact representation for arrays of Floats.

-- Johan

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
John Lato | 1 Mar 17:15 2014
Picon

Re: [Haskell] Can Haskell use short floats; i.e. 16 bit floats to save space?

Did you mean unboxed vectors?  Storable vectors will store an Int16 in 16 bits, so that's another approach.


On Fri, Feb 28, 2014 at 11:56 PM, Johan Tibell <johan.tibell <at> gmail.com> wrote:
Am 01.03.2014 07:09, schrieb KC:

Can Haskell use short floats; i.e. 16 bit floats to save space?

GHC pads all basic data types to one word in its in-memory representation, so no. It's possible that the boxed vectors in the "vector" package has a more compact representation for arrays of Floats.

-- Johan


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Gmane