<!-- MHonArc v2.4.4 --> <!--X-Subject: [MUD-Dev] Network float format (RFC 1014) --> <!--X-From-R13: X Q Znjerapr <pynjNxnatn.ah> --> <!--X-Date: Wed, 14 Oct 1998 22:42:11 -0700 --> <!--X-Message-Id: E0zTgAt-0004nJ-00#mail,kanga.nu --> <!--X-Content-Type: text/plain --> <!--X-Head-End--> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <html> <head> <title>MUD-Dev message, [MUD-Dev] Network float format (RFC 1014)</title> <!-- meta name="robots" content="noindex,nofollow" --> <link rev="made" href="mailto:claw#kanga,nu"> </head> <body background="/backgrounds/paperback.gif" bgcolor="#ffffff" text="#000000" link="#0000FF" alink="#FF0000" vlink="#006000"> <font size="+4" color="#804040"> <strong><em>MUD-Dev<br>mailing list archive</em></strong> </font> <br> [ <a href="../">Other Periods</a> | <a href="../../">Other mailing lists</a> | <a href="/search.php3">Search</a> ] <br clear=all><hr> <!--X-Body-Begin--> <!--X-User-Header--> <!--X-User-Header-End--> <!--X-TopPNI--> Date: [ <a href="msg00214.html">Previous</a> | <a href="msg00216.html">Next</a> ] Thread: [ <a href="msg00327.html">Previous</a> | <a href="msg00210.html">Next</a> ] Index: [ <A HREF="author.html#00215">Author</A> | <A HREF="#00215">Date</A> | <A HREF="thread.html#00215">Thread</A> ] <!--X-TopPNI-End--> <!--X-MsgBody--> <!--X-Subject-Header-Begin--> <H1>[MUD-Dev] Network float format (RFC 1014)</H1> <HR> <!--X-Subject-Header-End--> <!--X-Head-of-Message--> <UL> <LI><em>To</em>: <A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A></LI> <LI><em>Subject</em>: [MUD-Dev] Network float format (RFC 1014)</LI> <LI><em>From</em>: J C Lawrence <<A HREF="mailto:claw#kanga,nu">claw#kanga,nu</A>></LI> <LI><em>Date</em>: Wed, 14 Oct 1998 22:42:10 -0700</LI> <LI><em>Reply-To</em>: <A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A></LI> </UL> <!--X-Head-of-Message-End--> <!--X-Head-Body-Sep-Begin--> <HR> <!--X-Head-Body-Sep-End--> <!--X-Body-of-Message--> <PRE> Some time back there was a thread on the network format to use for floating point values (Ben?), with the observation that there was not equivalent to htonl() for such. The concern was for implementing client protocols where coordinate data exchanges might enclude floating point values. RFC 1014, "XDR: External Data Representation Standard" which can be found at <A HREF="http://www.pasteur.fr/other/computer/RFC/10xx/1014">http://www.pasteur.fr/other/computer/RFC/10xx/1014</A> has some to say on this area, and in fact addresses the general area of transmission formats rather thoroughly: --<cut>-- 3.6 Floating-point The standard defines the floating-point data type "float" (32 bits or 4 bytes). The encoding used is the IEEE standard for normalized single-precision floating-point numbers [3]. The following three fields describe the single-precision floating-point number: S: The sign of the number. Values 0 and 1 represent positive and negative, respectively. One bit. E: The exponent of the number, base 2. 8 bits are devoted to this field. The exponent is biased by 127. F: The fractional part of the number's mantissa, base 2. 23 bits are devoted to this field. Therefore, the floating-point number is described by: (-1)**S * 2**(E-Bias) * 1.F It is declared as follows: float identifier; +-------+-------+-------+-------+ |byte 0 |byte 1 |byte 2 |byte 3 | SINGLE-PRECISION S| E | F | FLOATING-POINT NUMBER +-------+-------+-------+-------+ 1|<- 8 ->|<-------23 bits------>| <------------32 bits------------> Just as the most and least significant bytes of a number are 0 and 3, the most and least significant bits of a single-precision floating- point number are 0 and 31. The beginning bit (and most significant bit) offsets of S, E, and F are 0, 1, and 9, respectively. Note that these numbers refer to the mathematical positions of the bits, and NOT to their actual physical locations (which vary from medium to medium). The EEE specifications should be consulted concerning the encoding for signed zero, signed infinity (overflow), and denormalized numbers (underflow) [3]. According to IEEE specifications, the "NaN" (not a number) is system dependent and should not be used externally. --<cut>-- With further text on doubles, fixed lenth arrays, variable length arrays, unions, structures, defined types etc. -- J C Lawrence Internet: claw#kanga,nu ----------(*) Internet: coder#kanga,nu ...Honourary Member of Clan McFud -- Teamer's Avenging Monolith... </PRE> <!--X-Body-of-Message-End--> <!--X-MsgBody-End--> <!--X-Follow-Ups--> <HR> <!--X-Follow-Ups-End--> <!--X-References--> <!--X-References-End--> <!--X-BotPNI--> <UL> <LI>Prev by Date: <STRONG><A HREF="msg00214.html">[MUD-Dev] Re: Trusting the Client (Re: Laws of Online World Design)</A></STRONG> </LI> <LI>Next by Date: <STRONG><A HREF="msg00216.html">[MUD-Dev] Re: [Tech] socket slowdown solved</A></STRONG> </LI> <LI>Prev by thread: <STRONG><A HREF="msg00327.html">[MUD-Dev] Re: Bruce Sterling on Virtual Community goals</A></STRONG> </LI> <LI>Next by thread: <STRONG><A HREF="msg00210.html">[MUD-Dev] ADMIN: unsubscriptions</A></STRONG> </LI> <LI>Index(es): <UL> <LI><A HREF="index.html#00215"><STRONG>Date</STRONG></A></LI> <LI><A HREF="thread.html#00215"><STRONG>Thread</STRONG></A></LI> </UL> </LI> </UL> <!--X-BotPNI-End--> <!--X-User-Footer--> <!--X-User-Footer-End--> <ul><li>Thread context: <BLOCKQUOTE><UL> <LI><STRONG>[MUD-Dev] Re: Bruce Sterling on Virtual Community goals</STRONG>, <EM>(continued)</EM> <ul compact> <ul compact> <ul compact> <LI><strong><A NAME="00246" HREF="msg00246.html">[MUD-Dev] Re: Bruce Sterling on Virtual Community goals</A></strong>, Jon Leonard <a href="mailto:jleonard#divcom,slimy.com">jleonard#divcom,slimy.com</a>, Mon 19 Oct 1998, 18:49 GMT <UL> <LI><strong><A NAME="00277" HREF="msg00277.html">[MUD-Dev] Re: Bruce Sterling on Virtual Community goals</A></strong>, Elis Pomales <a href="mailto:pomales#caip,rutgers.edu">pomales#caip,rutgers.edu</a>, Tue 20 Oct 1998, 18:31 GMT <UL> <LI><strong><A NAME="00299" HREF="msg00299.html">[MUD-Dev] Re: Bruce Sterling on Virtual Community goals</A></strong>, Darrin Hyrup <a href="mailto:shades#mythicgames,com">shades#mythicgames,com</a>, Wed 21 Oct 1998, 15:06 GMT <UL> <LI><strong><A NAME="00327" HREF="msg00327.html">[MUD-Dev] Re: Bruce Sterling on Virtual Community goals</A></strong>, J C Lawrence <a href="mailto:claw#under,engr.sgi.com">claw#under,engr.sgi.com</a>, Thu 22 Oct 1998, 01:16 GMT </LI> </UL> </LI> </UL> </LI> </UL> </LI> </ul> </ul> </ul> </LI> <LI><strong><A NAME="00215" HREF="msg00215.html">[MUD-Dev] Network float format (RFC 1014)</A></strong>, J C Lawrence <a href="mailto:claw#kanga,nu">claw#kanga,nu</a>, Thu 15 Oct 1998, 05:42 GMT <LI><strong><A NAME="00210" HREF="msg00210.html">[MUD-Dev] ADMIN: unsubscriptions</A></strong>, J C Lawrence <a href="mailto:claw#under,engr.sgi.com">claw#under,engr.sgi.com</a>, Wed 14 Oct 1998, 22:30 GMT <UL> <li><Possible follow-up(s)><br> <LI><strong><A NAME="00358" HREF="msg00358.html">[MUD-Dev] ADMIN: Unsubscriptions</A></strong>, J C Lawrence <a href="mailto:claw#under,engr.sgi.com">claw#under,engr.sgi.com</a>, Thu 22 Oct 1998, 18:07 GMT </LI> <LI><strong><A NAME="00673" HREF="msg00673.html">[MUD-Dev] ADMIN: Unsubscriptions</A></strong>, J C Lawrence <a href="mailto:claw#kanga,nu">claw#kanga,nu</a>, Sun 01 Nov 1998, 17:34 GMT </LI> </UL> </LI> <LI><strong><A NAME="00207" HREF="msg00207.html">[MUD-Dev] Re: Trusting the Client (Re: Laws of Online WorldD esign)</A></strong>, Wilburn, E.J. <a href="mailto:WilburnE#kochind,com">WilburnE#kochind,com</a>, Wed 14 Oct 1998, 20:45 GMT </LI> </UL></BLOCKQUOTE> </ul> <hr> <center> [ <a href="../">Other Periods</a> | <a href="../../">Other mailing lists</a> | <a href="/search.php3">Search</a> ] </center> <hr> </body> </html>