⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mathfp.html

📁 除了支持一般的小数运算
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../net/jscience/math/waba/MathFP.html#sqrt(int)">sqrt</A></B>(int&nbsp;n)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the square root of the the fixed-point integer.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../net/jscience/math/waba/MathFP.html#sqrt(int, int)">sqrt</A></B>(int&nbsp;n,     int&nbsp;r)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the square root of the the fixed-point integer.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../net/jscience/math/waba/MathFP.html#stat()">stat</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the internal overflow value if any  </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../net/jscience/math/waba/MathFP.html#sub(int, int)">sub</A></B>(int&nbsp;n,    int&nbsp;m)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Subtracts two fixed-point integers.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../net/jscience/math/waba/MathFP.html#tan(int)">tan</A></B>(int&nbsp;r)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the tangent of the radian fixed-point integer.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../net/jscience/math/waba/MathFP.html#toFP(int)">toFP</A></B>(int&nbsp;l)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Converts a normal int to a fixed-point integer.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../net/jscience/math/waba/MathFP.html#toFP(java.lang.String)">toFP</A></B>(java.lang.String&nbsp;s)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Converts a string input to a fixed-point integer.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../net/jscience/math/waba/MathFP.html#toInt(int)">toInt</A></B>(int&nbsp;x)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Converts a fixed-point integer to a int.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;java.lang.String</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../net/jscience/math/waba/MathFP.html#toString(int)">toString</A></B>(int&nbsp;l)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Converts a fixed-point integer to a string.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;java.lang.String</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../net/jscience/math/waba/MathFP.html#toString(int, int)">toString</A></B>(int&nbsp;x,         int&nbsp;d)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Converts a fixed-point integer to a string with rounding.</TD></TR></TABLE>&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from class java.lang.Object</B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE>equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD></TR></TABLE>&nbsp;<P><!-- ============ FIELD DETAIL =========== --><A NAME="field_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Field Detail</B></FONT></TD></TR></TABLE><A NAME="PI"><!-- --></A><H3>PI</H3><PRE>public static int <B>PI</B></PRE><DL><DD>The fixed-point representation of pi (3.1416)</DL><HR><A NAME="E"><!-- --></A><H3>E</H3><PRE>public static int <B>E</B></PRE><DL><DD>The fixed-point representation of the natural number (2.7183).</DL><HR><A NAME="MAX_VALUE"><!-- --></A><H3>MAX_VALUE</H3><PRE>public static final int <B>MAX_VALUE</B></PRE><DL><DD>The maximum fixed-point representation for the current precision.</DL><HR><A NAME="MIN_VALUE"><!-- --></A><H3>MIN_VALUE</H3><PRE>public static final int <B>MIN_VALUE</B></PRE><DL><DD>The minimum fixed-point representation for the current precision.</DL><!-- ========= CONSTRUCTOR DETAIL ======== --><A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Constructor Detail</B></FONT></TD></TR></TABLE><A NAME="MathFP()"><!-- --></A><H3>MathFP</H3><PRE>public <B>MathFP</B>()</PRE><DL></DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="setPrecision(int)"><!-- --></A><H3>setPrecision</H3><PRE>public static int <B>setPrecision</B>(int&nbsp;p)</PRE><DL><DD>Set the runtime precision for MathFP.  <p> The precision can be anywhere from 12 to 0 bits. However using 0 bits for the precision makes no sense for this library. The lowest setting would usually be 3. The default precision is 12 bits for the fraction.<DD><DL><DT><B>Parameters:</B><DD><CODE>p</CODE> - the number of fractional bits.<DT><B>Returns:</B><DD>the number of visual digits behind the decimal point.<DT><B>Since: </B><DD>MathFP 2.0.3</DD></DL></DD></DL><HR><A NAME="getPrecision()"><!-- --></A><H3>getPrecision</H3><PRE>public static int <B>getPrecision</B>()</PRE><DL><DD>Get the current runtime precision for MathFP.  <p> The current precision is expressed in  the number of bits used for the fractional part.<DD><DL><DT><B>Returns:</B><DD>the size of the fraction expressed in the number of bits.<DT><B>Since: </B><DD>MathFP 2.0.3</DD></DL></DD></DL><HR><A NAME="toInt(int)"><!-- --></A><H3>toInt</H3><PRE>public static int <B>toInt</B>(int&nbsp;x)</PRE><DL><DD>Converts a fixed-point integer to a int.  <p> This method will round the fixed point integer before converting it to a normal  int. To avoid rounding you can shift the value precision bits to the right.<DD><DL><DT><B>Parameters:</B><DD><CODE>x</CODE> - the fixed-point integer to be converted.<DT><B>Returns:</B><DD>a int in a normal integer representation.<DT><B>Since: </B><DD>MathFP 1.0</DD></DL></DD></DL><HR><A NAME="toFP(int)"><!-- --></A><H3>toFP</H3><PRE>public static int <B>toFP</B>(int&nbsp;l)</PRE><DL><DD>Converts a normal int to a fixed-point integer.  <p> The input int will be shifted the number of fraction bits to  the left.<DD><DL><DT><B>Parameters:</B><DD><CODE>l</CODE> - the int to be converted to a fixed-point integer<DT><B>Returns:</B><DD>a fixed-point integer with runtime precision bits fraction.<DT><B>Since: </B><DD>MathFP 1.0</DD></DL></DD></DL><HR><A NAME="convert(int, int)"><!-- --></A><H3>convert</H3><PRE>public static int <B>convert</B>(int&nbsp;l,                          int&nbsp;o)</PRE><DL><DD>Changes precision of a fixed-point integer. <p> See net.jscience.math.MathFP for more details.<DD><DL><DT><B>Parameters:</B><DD><CODE>l</CODE> - the fixed-point to change the precision of.<DD><CODE>o</CODE> - the current precision of the fixed-point integer.<DT><B>Returns:</B><DD>a fixed-point integer with the current runtime precision.<DT><B>Since: </B><DD>MathFP 1.0</DD></DL></DD></DL><HR><A NAME="toFP(java.lang.String)"><!-- --></A><H3>toFP</H3><PRE>public static int <B>toFP</B>(java.lang.String&nbsp;s)</PRE><DL><DD>Converts a string input to a fixed-point integer.  <p> See net.jscience.math.MathFP for more details.<DD><DL><DT><B>Parameters:</B><DD><CODE>s</CODE> - the String to be converted to a fixed-point integer.<DT><B>Returns:</B><DD>a fixed-point integer with precision bits fraction.<DT><B>Throws:</B><DD><CODE>java.lang.NumberFormatException</CODE> - if the input is invalid.<DT><B>Since: </B><DD>MathFP 1.0</DD></DL></DD></DL><HR><A NAME="toString(int)"><!-- --></A><H3>toString</H3><PRE>public static java.lang.String <B>toString</B>(int&nbsp;l)</PRE><DL><DD>Converts a fixed-point integer to a string.  <p> See net.jscience.math.MathFP for more details.<DD><DL><DT><B>Parameters:</B><DD><CODE>x</CODE> - the fixed-point integer to be converted.<DT><B>Returns:</B><DD>a string representing the fixed-point integer value.<DT><B>Since: </B><DD>MathFP 2.0.3</DD></DL></DD></DL><HR><A NAME="toString(int, int)"><!-- --></A><H3>toString</H3><PRE>public static java.lang.String <B>toString</B>(int&nbsp;x,                                        int&nbsp;d)</PRE><DL><DD>Converts a fixed-point integer to a string with rounding.  <p> Possible values for d are 0 through 8 depending on the current runtime precision.   See net.jscience.math.MathFP for more details.<DD><DL><DT><B>Parameters:</B><DD><CODE>x</CODE> - the fixed-point integer to be converted.<DD><CODE>d</CODE> - the number of digits to show of the fraction.<DT><B>Returns:</B><DD>a string representing the rounded fixed-point integer.<DT><B>Since: </B><DD>MathFP 1.0.2</DD></DL></DD></DL><HR><A NAME="max(int, int)"><!-- --></A><H3>max</H3><PRE>public static int <B>max</B>(int&nbsp;n,                      int&nbsp;m)</PRE><DL><DD>Returns the biggest number of the two fixed-point integers.  <p> See net.jscience.math.MathFP for more details.<DD><DL><DT><B>Parameters:</B><DD><CODE>n</CODE> - a fixed-point integer.<DD><CODE>m</CODE> - a fixed-point integer.<DT><B>Returns:</B><DD>the maximum of the two fixed-point integers n,m.<DT><B>Since: </B><DD>MathFP 1.0.2</DD></DL></DD></DL><HR><A NAME="min(int, int)"><!-- --></A><H3>min</H3><PRE>public static int <B>min</B>(int&nbsp;n,                      int&nbsp;m)</PRE><DL><DD>Returns the smallest number of the two fixed-point integers.  <p> See net.jscience.math.MathFP for more details.<DD><DL><DT><B>Parameters:</B><DD><CODE>n</CODE> - a fixed-point integer.<DD><CODE>m</CODE> - a fixed-point integer.<DT><B>Returns:</B><DD>the smallest number of the two fixed-point integers n,m.<DT><B>Since: </B><DD>MathFP 1.0.2</DD></DL></DD></DL><HR><A NAME="round(int, int)"><!-- --></A><H3>round</H3><PRE>public static int <B>round</B>(int&nbsp;x,                        int&nbsp;d)</PRE><DL><DD>rounds a fixed-point integer.  <p> The maximum number of digits to round to is 4 but can be lower depending on the current runtime precision. See net.jscience.math.MathFP for more details.<DD><DL><DT><B>Parameters:</B><DD><CODE>x</CODE> - the fixed-point integer to be rounded<DD><CODE>d</CODE> - the number of precision digits to round to.<DT><B>Returns:</B><DD>a  rounded fixed-point integer.<DT><B>Since: </B><DD>MathFP 1.0.2</DD></DL></DD></DL>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -