Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: jean-marc alliot <alliot@r...>
Subject: Re: single-precision floats, etc.
David Gurr wrote:

> > 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.

Yes, but there are drawbacks:
1) you have to write anyway something in assembly language to easily get
down to this level. I concede that one (small) problem of ocaml is the fact
that external functions written in assembly or C can not be inlined. This is
mainly what I would ask Xavier to think about, but it is clearly a major
2) Performances get as high as 4 Gflops on a 1Ghz P-III, but it is only true
when you can have vectorizable code. It is usually not that easy to
vectorize an application, and one multiplication between 2 packed 4-float
vectors on a P-III is not faster than a multiplication between 2 doubles
(well, with the pipelining techniques on the P-III, many things depend on
what is before and after the instruction, but I am probably right on the
3) float are very often not enough in precision for many applications.

A demonstration of vectorization and precision problems are here :