Click here to Skip to main content
15,897,371 members
Articles / Programming Languages / C

Transform between IEEE, IBM or VAX floating point number formats and bytes expressions

Rate me:
Please Sign up or sign in to vote.
4.74/5 (14 votes)
21 Nov 20056 min read 106.6K   1.9K   27  
This program can transform between IEEE, IBM or VAX floating point number formats and their bytes expressions.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN" "http://www.w3.org/TR/REC-html40/frameset.dtd">
<html><head><!--NewPage--><!-- Generated by javadoc on Tue Oct 22 21:26:50 PDT 2002 --><title>: Class VAX_Float</title>


<link rel="stylesheet" type="text/css" href="VAX_Float_files/stylesheet.css" title="Style"></head>


<body bgcolor="white">

<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" cellpadding="1" cellspacing="0" width="100%">
<tbody><tr>
<td colspan="2" class="NavBarCell1" bgcolor="#eeeeff">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
  <tbody><tr align="center" valign="top">
  <td class="NavBarCell1" bgcolor="#eeeeff">    <a href="http://cynosurex.granax.com//documents/CI_class/api/overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
  <td class="NavBarCell1" bgcolor="#eeeeff">    <a href="http://cynosurex.granax.com//documents/CI_class/api/cynosurex/legacy/package-summary.html"><font class="NavBarFont1"><b>Package</b></font></a>&nbsp;</td>
  <td class="NavBarCell1Rev" bgcolor="#ffffff"> &nbsp;<font class="NavBarFont1Rev"><b>Class</b></font>&nbsp;</td>
  <td class="NavBarCell1" bgcolor="#eeeeff">    <a href="http://cynosurex.granax.com//documents/CI_class/api/cynosurex/legacy/package-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
  <td class="NavBarCell1" bgcolor="#eeeeff">    <a href="http://cynosurex.granax.com//documents/CI_class/api/deprecated-list.html"><font class="NavBarFont1"><b>Deprecated</b></font></a>&nbsp;</td>
  <td class="NavBarCell1" bgcolor="#eeeeff">    <a href="http://cynosurex.granax.com//documents/CI_class/api/index-all.html"><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
  <td class="NavBarCell1" bgcolor="#eeeeff">    <a href="http://cynosurex.granax.com//documents/CI_class/api/help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
  </tr>
</tbody></table>
</td>
<td rowspan="3" align="right" valign="top"><em>
</em>
</td>
</tr>

<tr>
<td class="NavBarCell2" bgcolor="white"><font size="-2">
&nbsp;PREV CLASS&nbsp;
&nbsp;NEXT CLASS</font></td>
<td class="NavBarCell2" bgcolor="white"><font size="-2">
  <a href="http://cynosurex.granax.com//documents/CI_class/api/index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
&nbsp;<a href="http://cynosurex.granax.com//documents/CI_class/api/cynosurex/legacy/VAX_Float.html" target="_top"><b>NO FRAMES</b></a></font></td>
</tr>
<tr>
<td class="NavBarCell3" valign="top"><font size="-2">
  SUMMARY: &nbsp;INNER&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<a href="#method_summary">METHOD</a></font></td>
<td class="NavBarCell3" valign="top"><font size="-2">
DETAIL: &nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<a href="#method_detail">METHOD</a></font></td>
</tr>
</tbody></table>
<!-- =========== END OF NAVBAR =========== -->

<hr>
<!-- ======== START OF CLASS DATA ======== -->
<h2>
<font size="-1">
cynosurex.legacy</font>
<br>
Class  VAX_Float</h2>
<pre>java.lang.Object
  |
  +--<b>cynosurex.legacy.VAX_Float</b>
</pre>
<dl>
<dt><b>All Implemented Interfaces:</b> </dt><dd>cynosurex.internal.AuthorCommon, cynosurex.internal.CommonInterface, cynosurex.internal.CompanyCommon</dd>
</dl>
<hr>
<dl>
<dt>public class <b>VAX_Float</b></dt><dt>extends java.lang.Object</dt><dt>implements cynosurex.internal.CommonInterface</dt></dl>

<p>
</p><p>
 This class includes static methods to read and convert
 various VAX float format.
 This class cannot be instantiated.
 </p>
<p>
</p><hr>

<p>
<!-- ======== INNER CLASS SUMMARY ======== -->


<!-- =========== FIELD SUMMARY =========== -->

<a name="fields_inherited_from_class_cynosurex.internal.CommonInterface"><!-- --></a>
<table border="1" cellpadding="3" cellspacing="0" width="100%">
<tbody><tr class="TableSubHeadingColor" bgcolor="#eeeeff">
<td><b>Fields inherited from interface cynosurex.internal.CommonInterface</b></td>
</tr>
<tr class="TableRowColor" bgcolor="white">
<td><code>copyright, copyrightYears, notice, program, version</code></td>
</tr>
</tbody></table>
&nbsp;<a name="fields_inherited_from_class_cynosurex.internal.AuthorCommon"><!-- --></a>
<table border="1" cellpadding="3" cellspacing="0" width="100%">
<tbody><tr class="TableSubHeadingColor" bgcolor="#eeeeff">
<td><b>Fields inherited from interface cynosurex.internal.AuthorCommon</b></td>
</tr>
<tr class="TableRowColor" bgcolor="white">
<td><code>author, copyrightSymbol, noticeMsg, rights</code></td>
</tr>
</tbody></table>
&nbsp;<a name="fields_inherited_from_class_cynosurex.internal.CompanyCommon"><!-- --></a>
<table border="1" cellpadding="3" cellspacing="0" width="100%">
<tbody><tr class="TableSubHeadingColor" bgcolor="#eeeeff">
<td><b>Fields inherited from interface cynosurex.internal.CompanyCommon</b></td>
</tr>
<tr class="TableRowColor" bgcolor="white">
<td><code>company, email, website</code></td>
</tr>
</tbody></table>
&nbsp;
<!-- ======== CONSTRUCTOR SUMMARY ======== -->


<!-- ========== METHOD SUMMARY =========== -->

<a name="method_summary"><!-- --></a>
<table border="1" cellpadding="3" cellspacing="0" width="100%">
<tbody><tr class="TableHeadingColor" bgcolor="#ccccff">
<td colspan="2"><font size="+2">
<b>Method Summary</b></font></td>
</tr>
<tr class="TableRowColor" bgcolor="white">
<td align="right" valign="top" width="1%"><font size="-1">
<code>static&nbsp;double</code></font></td>
<td><code><b><a href="http://cynosurex.granax.com//documents/CI_class/api/cynosurex/legacy/VAX_Float.html#D_float_to_double%28byte%5B%5D%29">D_float_to_double</a></b>(byte[]&nbsp;d_float)</code>

<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This static method takes in a VAX D-Float
 and returns a Java double-precision floating
 point.</td>
</tr>
<tr class="TableRowColor" bgcolor="white">
<td align="right" valign="top" width="1%"><font size="-1">
<code>static&nbsp;float</code></font></td>
<td><code><b><a href="http://cynosurex.granax.com//documents/CI_class/api/cynosurex/legacy/VAX_Float.html#F_float_to_float%28byte%5B%5D%29">F_float_to_float</a></b>(byte[]&nbsp;f_float)</code>

<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This static method takes in a VAX F-Float
 and returns a Java 32-bit floating
 point.</td>
</tr>
</tbody></table>
&nbsp;<a name="methods_inherited_from_class_java.lang.Object"><!-- --></a>
<table border="1" cellpadding="3" cellspacing="0" width="100%">
<tbody><tr class="TableSubHeadingColor" bgcolor="#eeeeff">
<td><b>Methods inherited from class java.lang.Object</b></td>
</tr>
<tr class="TableRowColor" bgcolor="white">
<td><code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></td>
</tr>
</tbody></table>
&nbsp;
</p><p>

<!-- ============ FIELD DETAIL =========== -->


<!-- ========= CONSTRUCTOR DETAIL ======== -->


<!-- ============ METHOD DETAIL ========== -->

<a name="method_detail"><!-- --></a>
<table border="1" cellpadding="3" cellspacing="0" width="100%">
<tbody><tr class="TableHeadingColor" bgcolor="#ccccff">
<td colspan="1"><font size="+2">
<b>Method Detail</b></font></td>
</tr>
</tbody></table>

<a name="F_float_to_float(byte[])"><!-- --></a></p><h3>
F_float_to_float</h3>
<pre>public static float <b>F_float_to_float</b>(byte[]&nbsp;f_float)</pre>
<dl>
<dd>This static method takes in a VAX F-Float
 and returns a Java 32-bit floating
 point. This method throws IndexOutOfBoundsException
 if the length of the array is not 4 bytes (32 bits).
 It also throws ReservedOperandException if the biased
 exponent is 0 and the sign bit is 1.</dd><dd><dl>
</dl>
</dd>
<dd><dl>
<dt><b>Parameters:</b></dt><dd><code>f_float</code> - VAX F-Float bits</dd></dl>
</dd>
</dl>
<hr>

<a name="D_float_to_double(byte[])"><!-- --></a><h3>
D_float_to_double</h3>
<pre>public static double <b>D_float_to_double</b>(byte[]&nbsp;d_float)</pre>
<dl>
<dd>This static method takes in a VAX D-Float
 and returns a Java double-precision floating
 point. This method throws IndexOutOfBoundsException
 if the length of the array is not 8 bytes (64 bits).
 It also throws ReservedOperandException if the biased
 exponent is 0 and the sign bit is 1.</dd><dd><dl>
</dl>
</dd>
<dd><dl>
<dt><b>Parameters:</b></dt><dd><code>d_float</code> - VAX D-Float bits</dd></dl>
</dd>
</dl>
<!-- ========= END OF CLASS DATA ========= -->
<hr>

<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_bottom"><!-- --></a>
<table border="0" cellpadding="1" cellspacing="0" width="100%">
<tbody><tr>
<td colspan="2" class="NavBarCell1" bgcolor="#eeeeff">
<a name="navbar_bottom_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
  <tbody><tr align="center" valign="top">
  <td class="NavBarCell1" bgcolor="#eeeeff">    <a href="http://cynosurex.granax.com//documents/CI_class/api/overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
  <td class="NavBarCell1" bgcolor="#eeeeff">    <a href="http://cynosurex.granax.com//documents/CI_class/api/cynosurex/legacy/package-summary.html"><font class="NavBarFont1"><b>Package</b></font></a>&nbsp;</td>
  <td class="NavBarCell1Rev" bgcolor="#ffffff"> &nbsp;<font class="NavBarFont1Rev"><b>Class</b></font>&nbsp;</td>
  <td class="NavBarCell1" bgcolor="#eeeeff">    <a href="http://cynosurex.granax.com//documents/CI_class/api/cynosurex/legacy/package-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
  <td class="NavBarCell1" bgcolor="#eeeeff">    <a href="http://cynosurex.granax.com//documents/CI_class/api/deprecated-list.html"><font class="NavBarFont1"><b>Deprecated</b></font></a>&nbsp;</td>
  <td class="NavBarCell1" bgcolor="#eeeeff">    <a href="http://cynosurex.granax.com//documents/CI_class/api/index-all.html"><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
  <td class="NavBarCell1" bgcolor="#eeeeff">    <a href="http://cynosurex.granax.com//documents/CI_class/api/help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
  </tr>
</tbody></table>
</td>
<td rowspan="3" align="right" valign="top"><em>
</em>
</td>
</tr>

<tr>
<td class="NavBarCell2" bgcolor="white"><font size="-2">
&nbsp;PREV CLASS&nbsp;
&nbsp;NEXT CLASS</font></td>
<td class="NavBarCell2" bgcolor="white"><font size="-2">
  <a href="http://cynosurex.granax.com//documents/CI_class/api/index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
&nbsp;<a href="http://cynosurex.granax.com//documents/CI_class/api/cynosurex/legacy/VAX_Float.html" target="_top"><b>NO FRAMES</b></a></font></td>
</tr>
<tr>
<td class="NavBarCell3" valign="top"><font size="-2">
  SUMMARY: &nbsp;INNER&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<a href="#method_summary">METHOD</a></font></td>
<td class="NavBarCell3" valign="top"><font size="-2">
DETAIL: &nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<a href="#method_detail">METHOD</a></font></td>
</tr>
</tbody></table>
<!-- =========== END OF NAVBAR =========== -->

<hr>

</body></html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Software Developer
Canada Canada
My name is Jiyang Hou (or John Hou). I was born in HeiLongJiang province in north east of China. I got all my educations in China. My university major is Geophysics, but my main professional role is software developer. My biggest accomplishment so far is quit smoking about 5 years ago after almost 20 years smoking history. I am still interested on programming beside making living with it like many other developers. I immigrated to Canada in 2003 and became a permanent resident till now. I live in Calgary, Alberta, Canada. You can reach me by jyhou69@gmail.com regarding to any questions, comments, advice, etc.

Comments and Discussions