delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/07/29/21:17:51

To: combee AT cambridge DOT scr DOT slb DOT com, djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: help with reading floats from file
Date: Fri, 29 Jul 1994 15:46:11 PDT
From: "Marty Leisner" <leisner AT sdsp DOT mc DOT xerox DOT com>

> > 
> >   I have trouble reading binary floating point data (4bytes/value) from a
> >   file generated on a sun/unix into my code compiled with djgpp.
> 
> For starters, Suns are big-endian and i386 are little-endian, so
> binary formats in general (even integers) are not going to be
> compatible.
> 
> Secondly, floating point binary formats aren't guaranteed to be the
> same across platforms.
> 
> You're best bet is to convert the values to strings for file storage.
> 
> 

Agreed.

Take a good look at your applications and determine if you really
need floats... (often times 2**16 or 2**32 discrete values are
fine).

If you need to transport floats, use ascii strings.   I don't
think ansi makes any guarantees on floating point formats...



marty
leisner AT sdsp DOT mc DOT xerox DOT com  
Member of the League for Programming Freedom
"I just know I'm a better manager when I have Joe DiMaggio in center field" -- 
Casey Stengel


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019