www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/02/24/18:03:39

From: Nate Eldredge <neldredge AT hmc DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: binary to float
Date: 24 Feb 2000 13:40:08 -0800
Organization: InterWorld Communications
Lines: 29
Message-ID: <83k8ju1dqf.fsf@mercury.st.hmc.edu>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1000224184303 DOT 16581A-100000 AT is>
NNTP-Posting-Host: mercury.st.hmc.edu
Mime-Version: 1.0
X-Trace: nntp1.interworld.net 951428538 33477 134.173.45.219 (24 Feb 2000 21:42:18 GMT)
X-Complaints-To: usenet AT nntp1 DOT interworld DOT net
NNTP-Posting-Date: 24 Feb 2000 21:42:18 GMT
User-Agent: Gnus/5.0802 (Gnus v5.8.2) Emacs/20.5
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> writes:

> On Thu, 24 Feb 2000, Dieter Buerssner wrote:
> 
> > unsigned long l;
> > float x;
> > fread(&l, sizeof l, 1, fp);
> > l = ntohl(l);
> > x = *(float *)&l;
> > 
> > My question, is this really more portable? In the libc info for ntohl 
> > under Portability I read: not ANSI, not POSIX. Is this function 
> > generally available?
> 
> I've seen them on every Unix box I had access to.
> 
> > Also, one other problem might arise when 
> > unsigned long is 64bit (i.e. Alpha, which uses IEEE floating point).
> 
> I don't have access to an Alpha to check.  Anybody?

I do, but the original test program has been snipped, and I'm not
entirely sure from context what it was testing.  Someone care to send
it to me?

-- 

Nate Eldredge
neldredge AT hmc DOT edu

- Raw text -


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