Sophie

Sophie

distrib > Mageia > 7 > x86_64 > by-pkgid > b3bdfe6d859a3d6920ff2c44b38e9a6f > files > 2875

saxon-manual-9.4.0.9-2.mga7.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_18) on Fri Dec 09 20:48:44 GMT 2011 -->
<TITLE>
FloatingPointConverter
</TITLE>

<META NAME="date" CONTENT="2011-12-09">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">

<SCRIPT type="text/javascript">
function windowTitle()
{
    if (location.href.indexOf('is-external=true') == -1) {
        parent.document.title="FloatingPointConverter";
    }
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>

</HEAD>

<BODY BGCOLOR="white" onload="windowTitle();">
<HR>


<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../net/sf/saxon/value/EmptySequence.html" title="class in net.sf.saxon.value"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../net/sf/saxon/value/FloatValue.html" title="class in net.sf.saxon.value"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../index.html?net/sf/saxon/value/FloatingPointConverter.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="FloatingPointConverter.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>


</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->

<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
net.sf.saxon.value</FONT>
<BR>
Class FloatingPointConverter</H2>
<PRE>
<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</A>
  <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>net.sf.saxon.value.FloatingPointConverter</B>
</PRE>
<HR>
<DL>
<DT><PRE>public class <B>FloatingPointConverter</B><DT>extends <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></DL>
</PRE>

<P>
This is a utility class that handles formatting of numbers as strings.
 <p>
 The algorithm for converting a floating point number to a string is taken from Guy L. Steele and
 Jon L. White, <i>How to Print Floating-Point Numbers Accurately</i>, ACM SIGPLAN 1990. It is algorithm
 (FPP)<sup>2</sup> from that paper. There are three separate implementations of the algorithm:
 <ul>
 <li>One using long arithmetic and generating non-exponential output representations
 <li>One using BigInteger arithmetic and generating non-exponential output representation
 <li>One using BigInteger arithmetic and generating exponential output representations
 </ul>
 <p>
 The choice of method depends on the value of the number being formatted.
 <p>
 The module contains some residual code (mainly the routine for formatting integers) from the class
 AppenderHelper by Jack Shirazi in the O'Reilly book <i>Java Performance Tuning</i>. The floating point routines
 in that module were found to be unsuitable, since they used floating point arithmetic which introduces
 rounding errors.
 <p>
 There are several reasons for doing this conversion within Saxon, rather than leaving it all to Java.
 Firstly, there are differences in the required output format, notably the absence of ".0" when formatting
 whole numbers, and the different rules for the range of numbers where exponential notation is used.
 Secondly, there are bugs in some Java implementations, for example JDK outputs 0.001 as 0.0010, and
 IKVM/GNU gets things very wrong sometimes. Finally, this implementation is faster for "everyday" numbers,
 though it is slower for more extreme numbers. It would probably be reasonable to hand over formatting
 to the Java platform (at least when running the Sun JDK) for exponents outside the range -7 to +7.
<P>

<P>
<HR>

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

<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Field Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;<A HREF="../../../../net/sf/saxon/value/FloatingPointConverter.html" title="class in net.sf.saxon.value">FloatingPointConverter</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sf/saxon/value/FloatingPointConverter.html#THE_INSTANCE">THE_INSTANCE</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
</TABLE>
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->

<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;<A HREF="../../../../net/sf/saxon/tree/util/FastStringBuffer.html" title="class in net.sf.saxon.tree.util">FastStringBuffer</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sf/saxon/value/FloatingPointConverter.html#appendDouble(net.sf.saxon.tree.util.FastStringBuffer, double, boolean)">appendDouble</A></B>(<A HREF="../../../../net/sf/saxon/tree/util/FastStringBuffer.html" title="class in net.sf.saxon.tree.util">FastStringBuffer</A>&nbsp;s,
             double&nbsp;d,
             boolean&nbsp;forceExponential)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Append a string representation of a double value to a string buffer</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;<A HREF="../../../../net/sf/saxon/tree/util/FastStringBuffer.html" title="class in net.sf.saxon.tree.util">FastStringBuffer</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sf/saxon/value/FloatingPointConverter.html#appendFloat(net.sf.saxon.tree.util.FastStringBuffer, float, boolean)">appendFloat</A></B>(<A HREF="../../../../net/sf/saxon/tree/util/FastStringBuffer.html" title="class in net.sf.saxon.tree.util">FastStringBuffer</A>&nbsp;s,
            float&nbsp;f,
            boolean&nbsp;forceExponential)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Append a string representation of a float value to a string buffer</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;<A HREF="../../../../net/sf/saxon/tree/util/FastStringBuffer.html" title="class in net.sf.saxon.tree.util">FastStringBuffer</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sf/saxon/value/FloatingPointConverter.html#appendInt(net.sf.saxon.tree.util.FastStringBuffer, int)">appendInt</A></B>(<A HREF="../../../../net/sf/saxon/tree/util/FastStringBuffer.html" title="class in net.sf.saxon.tree.util">FastStringBuffer</A>&nbsp;s,
          int&nbsp;i)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Format an integer, appending the string representation of the integer to a string buffer</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>

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

<A NAME="field_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Field Detail</B></FONT></TH>
</TR>
</TABLE>

<A NAME="THE_INSTANCE"><!-- --></A><H3>
THE_INSTANCE</H3>
<PRE>
public static <A HREF="../../../../net/sf/saxon/value/FloatingPointConverter.html" title="class in net.sf.saxon.value">FloatingPointConverter</A> <B>THE_INSTANCE</B></PRE>
<DL>
<DL>
</DL>
</DL>

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

<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>

<A NAME="appendInt(net.sf.saxon.tree.util.FastStringBuffer, int)"><!-- --></A><H3>
appendInt</H3>
<PRE>
public static <A HREF="../../../../net/sf/saxon/tree/util/FastStringBuffer.html" title="class in net.sf.saxon.tree.util">FastStringBuffer</A> <B>appendInt</B>(<A HREF="../../../../net/sf/saxon/tree/util/FastStringBuffer.html" title="class in net.sf.saxon.tree.util">FastStringBuffer</A>&nbsp;s,
                                         int&nbsp;i)</PRE>
<DL>
<DD>Format an integer, appending the string representation of the integer to a string buffer
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>s</CODE> - the string buffer<DD><CODE>i</CODE> - the integer to be formatted
<DT><B>Returns:</B><DD>the supplied string buffer, containing the appended integer</DL>
</DD>
</DL>
<HR>

<A NAME="appendDouble(net.sf.saxon.tree.util.FastStringBuffer, double, boolean)"><!-- --></A><H3>
appendDouble</H3>
<PRE>
public static <A HREF="../../../../net/sf/saxon/tree/util/FastStringBuffer.html" title="class in net.sf.saxon.tree.util">FastStringBuffer</A> <B>appendDouble</B>(<A HREF="../../../../net/sf/saxon/tree/util/FastStringBuffer.html" title="class in net.sf.saxon.tree.util">FastStringBuffer</A>&nbsp;s,
                                            double&nbsp;d,
                                            boolean&nbsp;forceExponential)</PRE>
<DL>
<DD>Append a string representation of a double value to a string buffer
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>s</CODE> - the string buffer to which the result will be appended<DD><CODE>d</CODE> - the double to be formatted
<DT><B>Returns:</B><DD>the original string buffer, now containing the string representation of the supplied double</DL>
</DD>
</DL>
<HR>

<A NAME="appendFloat(net.sf.saxon.tree.util.FastStringBuffer, float, boolean)"><!-- --></A><H3>
appendFloat</H3>
<PRE>
public static <A HREF="../../../../net/sf/saxon/tree/util/FastStringBuffer.html" title="class in net.sf.saxon.tree.util">FastStringBuffer</A> <B>appendFloat</B>(<A HREF="../../../../net/sf/saxon/tree/util/FastStringBuffer.html" title="class in net.sf.saxon.tree.util">FastStringBuffer</A>&nbsp;s,
                                           float&nbsp;f,
                                           boolean&nbsp;forceExponential)</PRE>
<DL>
<DD>Append a string representation of a float value to a string buffer
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>s</CODE> - the string buffer to which the result will be appended<DD><CODE>f</CODE> - the float to be formatted<DD><CODE>forceExponential</CODE> - forces exponential notation if set (if not set, exponential notation
 is used only for values outside the range 1e-6 to 1e+6)
<DT><B>Returns:</B><DD>the original string buffer, now containing the string representation of the supplied float</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>


<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../net/sf/saxon/value/EmptySequence.html" title="class in net.sf.saxon.value"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../net/sf/saxon/value/FloatValue.html" title="class in net.sf.saxon.value"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../index.html?net/sf/saxon/value/FloatingPointConverter.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="FloatingPointConverter.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>


</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->

<HR>
Copyright (c) 2004-2011 Saxonica Limited. All rights reserved.
</BODY>
</HTML>