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
[Caml-list] 32 bit floats, SSE instructions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-06-08 (05:34)
From: Brandon J. Van Every <vanevery@i...>
Subject: RE: [Caml-list] 32 bit floats, SSE instructions
Nicolas Cannasse wrote:
> The main problem with float's - whatever if they are 32 or 64
> bits - is
> their boxing . OCaml runtime value representation is
> efficient but a float -
> even 32 bits - cannot be carried in a register as it could be in C.
> (actually some unboxing can be performed locally by ocamlopt). This is
> mainly because OCaml is an high-level language, with a
> garbage collector,
> and so needs to keep the track of what is being allocated in
> an efficient
> way. Did you imagine having an higher level programming
> language for free ?

Sounds like someone decided to pay for efficiency with uncleanliness.
That is not the only way to pay for things.  One could instead, for
instance, pay with a more difficult implementation.

> So yes maybe OCaml is not the best language to perform floating point
> operations, although the cost of boxing is actually quite
> small compared to
> the power of implementing easily more efficient algorithms.

The old "ah, let the algorithm deal with it!" saw.  Yawn.

> That's why you
> should perform batched operations in C - using 32bits float
> if you want -
> and manipulate your 64-bits vectors on the Ocaml side.

Since when are all numeric problems batch problems?  Batching in C is
only practical when problems are simple and highly repetitive.  What a
3D graphics guy often really wants, is the ability to inline a bunch of
function "pipeline" stages into one fairly complicated function.  The
transitions between pipeline stages should all be optimized together.

Brandon Van Every               Seattle, WA

"We live in a world of very bright people building
crappy software with total shit for tools and process."
                                - Ed Mckenzie

Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (
Version: 6.0.693 / Virus Database: 454 - Release Date: 5/31/2004

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: