From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA22027; Mon, 7 Jun 2004 22:41:11 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id WAA21876 for ; Mon, 7 Jun 2004 22:41:10 +0200 (MET DST) Received: from postfix3-1.free.fr (postfix3-1.free.fr [213.228.0.44]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i57Kf9EV005254 for ; Mon, 7 Jun 2004 22:41:09 +0200 Received: from warp (chateaudeau-4-82-225-176-25.fbx.proxad.net [82.225.176.25]) by postfix3-1.free.fr (Postfix) with SMTP id D79F2C5758; Mon, 7 Jun 2004 22:40:58 +0200 (CEST) Message-ID: <001c01c44ccf$964e4670$19b0e152@warp> From: "Nicolas Cannasse" To: "Brandon J. Van Every" , "caml" References: Subject: Re: [Caml-list] 32 bit floats, SSE instructions Date: Mon, 7 Jun 2004 22:39:47 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 X-Miltered: at nez-perce with ID 40C4D2E5.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; cannasse:01 warplayer:01 caml-list:01 floats:01 floats:01 slower:01 boxing:01 runtime:01 unboxing:01 ocamlopt:01 high-level:01 boxing:01 -bits:01 vectors:01 python:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > Basically it's not an answer to say "Ah, yes, look at this great > language OCaml!" when in practice all you're ever doing is writing C. > > I'm not exactly sure why language designers think 32 bit floats "don't > count." Quite a number of high level languages make the choice of > blowing them off. I guess quite a lot of high level languages aren't > interested in widespread industrial application, just ease of compiler > implementation. The reality is that 32 bit floats get used in the real > world all over the place by 3D graphics guys. That has something to do > with it being a core capability of many CPUs and an IEEE standard. 64 > bit floats cost twice as much memory, are much slower for division and > square rooting, and in many applications the extra precision is not > needed. 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 ? 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. 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. > The last time I tried to talk about 32 bit floats with 'language guys' > was the Python crowd. Generally speaking, that community doesn't have a > clue about performance, and hasn't coughed up any significant 3D > graphics work either. I guess that people who're refcounting don't care about performances :) Nicolas Cannasse ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners