From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c705819cb47d80d9 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Tue, 05 Sep 2006 00:18:52 +0200 From: Gautier User-Agent: Thunderbird 1.5.0.5 (Windows/20060719) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Q: Portable Ada floating-point binary I/O ? References: <44f09ac3$1_3@news.bluewin.ch> <44f201b0$1_6@news.bluewin.ch> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 83.77.185.142 X-Original-NNTP-Posting-Host: 83.77.185.142 Message-ID: <44fca63b_4@news.bluewin.ch> X-Trace: news.bluewin.ch 1157408315 83.77.185.142 (5 Sep 2006 00:18:35 +0200) Organization: Bluewin AG Complaints-To: abuse@bluewin.ch X-Original-NNTP-Posting-Host: 127.0.0.1 Path: g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns14feed!worldnet.att.net!164.128.36.58!news.ip-plus.net!newsfeed.ip-plus.net!news.bluewin.ch!not-for-mail Xref: g2news2.google.com comp.lang.ada:6451 Date: 2006-09-05T00:18:52+02:00 List-Id: >> > 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!