Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: single-precision floats, etc.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: David Gurr <gurr@m...>
Subject: Re: single-precision floats, etc.

Xavier Leroy:
> 
> Double-precision floats are hard-coded in a number of places in the
> OCaml implementation, such as the native-code generators, but also
> parts of the run-time system (e.g. the serializer and deserializer).
> Substituting single-precision floats everywhere is feasible, but a
> major undertaking.

Substituting single floats for double float would be a chore (I tried
and gave up).  But on machines where doubles are 64 bits and a packed
pair of singles is 64 bits, how hard would it be to generalize float
to allow any of the 64 bit arithmetric types (ie double floats,
pairs of single floats, pairs of 32 bit longs, quads of 16 bit shorts,
etc)?  

> I'm curious to why you need single floats.  It's certainly not for
> speed, because most processors nowadays do not compute over single
> floats any faster than over double floats.  

Machines with multimedia instruction sets do compute over single floats 
faster than double floats when the single floats are packed into a 64 bit 
pair of singles or a 128 bit quad of singles.

> Indeed, they convert
> single floats to double or extended precision at load time, and do
> all their arithmetic in double or extended precision.

They dont do conversion for packed floats and twice as many singles 
fit into a cache as do doubles.  
 
-David Gurr