From: Gautier <gautier@fakeaddress.nil>
Subject: Re: Q: Portable Ada floating-point binary I/O ?
Date: Tue, 05 Sep 2006 00:18:52 +0200
Date: 2006-09-05T00:18:52+02:00 [thread overview]
Message-ID: <44fca63b_4@news.bluewin.ch> (raw)
In-Reply-To: <ud5alyt0f.fsf@stephe-leake.org>
>> > However, the problem is - what does "portable" mean here? Range and
>> > precision cannot be portable, unless types aren't communicated as well.
>>
>> In my case, it should not be a problem; I have a deterministic file
>> format with some items expected as GL.Double, others as GL.Float. I
>> just want to ensure that the same file will be correctly read by a PC,
>> a Mac or a Playstation.
Stephen Leake:
> Those are all IEEE hardware, so all you need is byte-endianness
> conversions. See SAL http://stephe-leake.org/ada/sal.html for that, in
> particular sal-endianness_gnat_x86.ads, sal-network_order.ads, and
> sal-math_float-network_order.ads.
Thanks for the idea - however, for the project in question, I could restrict
up to now the compiler and machine dependency to the bindings (GL,GLU,GLUT),
and even there with very small differences. So I opted for a solution with
attributes (Dmitry) where I split the value into integers (mantissa in 1 or 2
parts, exponent), then slice them with a given endianess into bytes and merge
them back for reading.
You can see the result there: http://www.mysunrise.ch/users/gdm/g3d.htm
Gautier
______________________________________________________________
Ada programming -- http://www.mysunrise.ch/users/gdm/gsoft.htm
NB: For a direct answer, e-mail address on the Web site!
next prev parent reply other threads:[~2006-09-04 22:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-26 19:02 Q: Portable Ada floating-point binary I/O ? Gautier
2006-08-26 20:42 ` Dmitry A. Kazakov
2006-08-27 20:34 ` Gautier
2006-08-28 11:55 ` Stephen Leake
2006-09-04 22:18 ` Gautier [this message]
2006-08-29 2:03 ` Steve
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox