Brian Palmer
7/10/2006 1:57:00 AM
Hey,
On Jul 9, 2006, at 7:13 PM, nobu@ruby-lang.org wrote:
> Hi,
>
> At Mon, 10 Jul 2006 09:12:32 +0900,
> Brian Palmer wrote in [ruby-talk:201018]:
>> Yes, that's a biggie. I didn't realize that ruby compiled on non-IEEE
>> machines, but it makes sense now that I think about it. I think this
>> is out of my league, I suppose it would require integrating a
>> floating-point emulation library into ruby on such platforms, and
>> having that library handle the packing/marshaling, or even using that
>> library to back all Float objects on such platforms. I think that for
>> my purposes it makes more sense to just write a separate Marshal-type
>> extension library, since I only plan to target IA32, IA64 and Apple
>> G4/G5.
>
> What's the reason of your proposal?
>
> If it is for precision issue, rather I'd suppose to represent
> floating points in hexadecimal format.
>
> --
> Nobu Nakada
>
Actually, I'm not terribly concerned with precision, but rather with
speed and size. The application I'm building needs to communicate
data over a wireless network every 100 milliseconds, and it needs to
use as little bandwidth as possible. I was considering just using the
Marshal methods, but Marshal's floating-point representation killed
that idea, though for other Ruby built-in data types it seems to be
quite good, even truncating small integers to bytes and shorts. I've
decided that I only need a couple decimal places of accuracy, though,
so I'm just going to multiply each float by 100 and then convert it
to an int.
Out of curiousity, what do you mean by 'represent floating points in
hexadecimal format'? I've never heard of that before.
-- Brian Palmer