From: Mathieu Bouchard Date: 2001-03-20T13:56:07+09:00 Subject: [ruby-talk:12912] Re: Floating point performance & Garbage collection On Mon, 19 Mar 2001, Jean-Sebastien ROY wrote: > My first reaction was : Could Ruby store the floats like it stores the > integers ? > I then read a bit of the ruby source code and besides reducing the size > of the fixnum intergers, it does not seem possible. If Fixnums were constrained to the -2**29..(2**29-1) range, it would be possible to hold 30-bit floats in a reference. However Ruby's standard Floats are 64-bit (though each held in a 160-bit box), and single-precision floats (like C's) are 32-bit. Downsizing to 30-bit using a trick like f(float x); return *((unsigned*)&x)>>2;} (or whatever) is still feasible, but it remains that a ruby Float is assumed to be 64-bit, and unlike for Fixnums, this is a change in semantics. > NArray will probably provide the solution to most of my floating point > performance needs. Good idea. matju