📄 mathfp.html
字号:
<CODE>static long</CODE></FONT></TD><TD><CODE><B><A HREF="../../../net/jscience/math/MathFP.html#sqrt(long)">sqrt</A></B>(long n)</CODE><BR> 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 long</CODE></FONT></TD><TD><CODE><B><A HREF="../../../net/jscience/math/MathFP.html#sqrt(long, int)">sqrt</A></B>(long n, int r)</CODE><BR> 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 long</CODE></FONT></TD><TD><CODE><B><A HREF="../../../net/jscience/math/MathFP.html#sub(long, long)">sub</A></B>(long n, long m)</CODE><BR> Subtracts two fixed-point integers.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static long</CODE></FONT></TD><TD><CODE><B><A HREF="../../../net/jscience/math/MathFP.html#tan(long)">tan</A></B>(long r)</CODE><BR> 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 long</CODE></FONT></TD><TD><CODE><B><A HREF="../../../net/jscience/math/MathFP.html#toFP(long)">toFP</A></B>(long l)</CODE><BR> Converts a normal long to a fixed-point integer.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static long</CODE></FONT></TD><TD><CODE><B><A HREF="../../../net/jscience/math/MathFP.html#toFP(java.lang.String)">toFP</A></B>(java.lang.String s)</CODE><BR> 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 long</CODE></FONT></TD><TD><CODE><B><A HREF="../../../net/jscience/math/MathFP.html#toLong(long)">toLong</A></B>(long x)</CODE><BR> Converts a fixed-point integer to a long.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static java.lang.String</CODE></FONT></TD><TD><CODE><B><A HREF="../../../net/jscience/math/MathFP.html#toString(long)">toString</A></B>(long l)</CODE><BR> 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 java.lang.String</CODE></FONT></TD><TD><CODE><B><A HREF="../../../net/jscience/math/MathFP.html#toString(long, int)">toString</A></B>(long x, int d)</CODE><BR> Converts a fixed-point integer to a string with rounding.</TD></TR></TABLE> <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> <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 long <B>PI</B></PRE><DL><DD>The fixed-point representation of pi (3.14159265)</DL><HR><A NAME="E"><!-- --></A><H3>E</H3><PRE>public static long <B>E</B></PRE><DL><DD>The fixed-point representation of the natural number (2.71828183).</DL><HR><A NAME="MAX_VALUE"><!-- --></A><H3>MAX_VALUE</H3><PRE>public static final long <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 long <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 p)</PRE><DL><DD>Set the runtime precision for MathFP. <p> The precision can be anywhere from 24 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 24 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>KVM CLDC 1.0</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>KVM CLDC 1.0</DD></DL></DD></DL><HR><A NAME="toLong(long)"><!-- --></A><H3>toLong</H3><PRE>public static long <B>toLong</B>(long x)</PRE><DL><DD>Converts a fixed-point integer to a long. <p> This method will round the fixed point integer before converting it to a normal long. 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 long in a normal integer representation.<DT><B>Since: </B><DD>KVM CLDC 1.0</DD></DL></DD></DL><HR><A NAME="toFP(long)"><!-- --></A><H3>toFP</H3><PRE>public static long <B>toFP</B>(long l)</PRE><DL><DD>Converts a normal long to a fixed-point integer. <p> The input long will be shifted the number of fraction bits to the left.<DD><DL><DT><B>Parameters:</B><DD><CODE>l</CODE> - the long 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>KVM CLDC 1.0</DD></DL></DD></DL><HR><A NAME="convert(long, int)"><!-- --></A><H3>convert</H3><PRE>public static long <B>convert</B>(long l, int o)</PRE><DL><DD>Changes precision of a fixed-point integer. <p> The input long will be adjusted from its current precision to the current runtime precision. The function includes rounding before converting. This function allows the developer to use different precisions during runtime.<DD><DL><DT><B>Parameters:</B><DD><CODE>l</CODE> - the long 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>KVM CLDC 1.0</DD></DL></DD></DL><HR><A NAME="toFP(java.lang.String)"><!-- --></A><H3>toFP</H3><PRE>public static long <B>toFP</B>(java.lang.String s)</PRE><DL><DD>Converts a string input to a fixed-point integer. <p> This function will take the string and convert it to a fixed-point integer. If you specify more than the number of decimal digits as returned from setPrecision(...) then the additional decimal digits will be ignored. Invalid strings will result in a NumberFormatException (e.g. 1.ac23); Valid numbers are .5, 0.2, 20.1234, etc...<br> Numbers close to a natural number will sometimes be rounded to the natural number if that natural number is the closest representation in a fixed-point integer format For example 0.99999999 will become 1.<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>KVM CLDC 1.0</DD></DL></DD></DL><HR><A NAME="toString(long)"><!-- --></A><H3>toString</H3><PRE>public static java.lang.String <B>toString</B>(long l)</PRE><DL><DD>Converts a fixed-point integer to a string. <p> This method allows you to display a fixed-point integer in a more user friendly way. The number of digits behind the decimal point will be the number returned by setPrecision(...).<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>KVM CLDC 1.0</DD></DL></DD></DL><HR><A NAME="toString(long, int)"><!-- --></A><H3>toString</H3><PRE>public static java.lang.String <B>toString</B>(long x, int d)</PRE><DL><DD>Converts a fixed-point integer to a string with rounding. <p> This method allows you to display a fixed-point integer in a more user friendly. In addition one can specify the number of digits after the decimal point. Possible values are 0 through 8 depending on the current runtime precision. Any other number will will have the default number of digits based on the runtime precision. This method uses the normal round. E.g. 1.05 displayed with 1 digit of the fraction becomes 1.1<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>KVM-DR4.1</DD></DL></DD></DL><HR><A NAME="max(long, long)"><!-- --></A><H3>max</H3><PRE>public static long <B>max</B>(long n, long m)</PRE><DL><DD>Returns the biggest number of the two fixed-point integers. <p> This method returns the biggest of the two numbers.<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>KVM CLDC 1.0</DD></DL></DD></DL><HR><A NAME="min(long, long)"><!-- --></A><H3>min</H3><PRE>public static long <B>min</B>(long n, long m)</PRE><DL><DD>Returns the smallest number of the two fixed-point integers. <p> This method returns the smallest of the two numbers.<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>KVM CLDC 1.0</DD></DL></DD></DL><HR><A NAME="round(long, int)"><!-- --></A><H3>round</H3><PRE>public static long <B>round</B>(long x, int d)</PRE><DL><DD>rounds a fixed-point integer. <p> This method will round the fixed point integer x to a precision of d digits. the maximum number of digits to round to is 8 but can be lower depending on the current runtime precision. The minimum is 0. Any other number will use the default precision digits which depends on the runtime precision.<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>KVM CLDC 1.0</DD></DL></DD></DL><HR><A NAME="mul(long, long)"><!-- --></A><H3>mul</H3><PRE>public static long <B>mul</B>(long n, long m)</PRE><DL><DD>Multiplies two fixed-point integers. <p> The method will multiply the fixed-point n with the fixed-point m.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -