亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? mathfunc.java

?? 一套j2me的UI界面庫
?? JAVA
字號:
package org.j4me.util;

/**
 * Implements the methods which are in the standard J2SE's <code>Math</code> class,
 * but are not in in J2ME's.
 * <p>
 * The following methods are still missing from the implementation:
 * <ul>
 *  <li><code>public static double exp (double a)</code>
 *  <li><code>public static double log (double a)</code>
 *  <li><code>public static double pow (double a, double b)</code>
 *  <li><code>public static double random ()</code>
 *  <li><code>public static double rint()</code>
 * </ul>
 * 
 * @see java.lang.Math
 */
public final class MathFunc
{
	/**
	 * Constant for PI divided by 2.
	 */
	private static final double PIover2 = Math.PI / 2;

	/**
	 * Constant for PI divided by 4.
	 */
	private static final double PIover4 = Math.PI / 4;

	/**
	 * Constant for PI divided by 6.
	 */
	private static final double PIover6 = Math.PI / 6;

	/**
	 * Constant for PI divided by 12.
	 */
	private static final double PIover12 = Math.PI / 12;

	/**
	 * Constant used in the <code>atan</code> calculation.
	 */
	private static final double ATAN_CONSTANT = 1.732050807569;

	/**
	 * Returns the arc cosine of an angle, in the range of 0.0 through <code>Math.PI</code>.
	 * Special case:
	 * <ul>
	 *  <li>If the argument is <code>NaN</code> or its absolute value is greater than 1,
	 *      then the result is <code>NaN</code>.
	 * </ul>
	 * 
	 * @param a - the value whose arc cosine is to be returned.
	 * @return the arc cosine of the argument.
	 */
	public static double acos (double a)
	{
		// Special case.
		if ( Double.isNaN(a) || Math.abs(a) > 1.0 )
		{
			return Double.NaN;
		}
		
		// Calculate the arc cosine.
		double aSquared = a * a;
		double arcCosine = atan2( Math.sqrt(1 - aSquared), a );
		return arcCosine;
	}

	/**
	 * Returns the arc sine of an angle, in the range of <code>-Math.PI/2</code> through
	 * <code>Math.PI/2</code>.  Special cases:
	 * <ul>
	 *  <li>If the argument is <code>NaN</code> or its absolute value is greater than 1,
	 *      then the result is <code>NaN</code>.
	 *  <li>If the argument is zero, then the result is a zero with the same sign
	 *      as the argument.
	 * </ul>
	 * 
	 * @param a - the value whose arc sine is to be returned.
	 * @return the arc sine of the argument.
	 */
	public static double asin (double a)
	{
		// Special cases.
		if ( Double.isNaN(a) || Math.abs(a) > 1.0 )
		{
			return Double.NaN;
		}

		if ( a == 0.0 )
		{
			return a;
		}
		
		// Calculate the arc sine.
		double aSquared = a * a;
		double arcSine = atan2( a, Math.sqrt(1 - aSquared) );
		return arcSine;
	}

	/**
	 * Returns the arc tangent of an angle, in the range of <code>-Math.PI/2</code>
	 * through <code>Math.PI/2</code>.  Special cases:
	 * <ul>
	 *  <li>If the argument is <code>NaN</code>, then the result is <code>NaN</code>.
	 *  <li>If the argument is zero, then the result is a zero with the same 
	 *      sign as the argument.
	 * </ul>
	 * <p>
	 * A result must be within 1 ulp of the correctly rounded result.  Results
	 * must be semi-monotonic.
	 * 
	 * @param a - the value whose arc tangent is to be returned. 
	 * @return the arc tangent of the argument.
	 */
	public static double atan (double a)
	{
		// Special cases.
		if ( Double.isNaN(a) )
		{
			return Double.NaN;
		}
		
		if ( a == 0.0 )
		{
			return a;
		}
		
		// Compute the arc tangent.
		boolean negative = false;
		boolean greaterThanOne = false;
		int i = 0;
		
		if ( a < 0.0 )
		{
			a = -a;
			negative = true;
		}
		
		if ( a > 1.0 )
		{
			a = 1.0 / a;
			greaterThanOne = true;
		}
		
		double t;
		
		for ( ; a > PIover12; a *= t )
		{
			i++;
			t = a + ATAN_CONSTANT;
			t = 1.0 / t;
			a *= ATAN_CONSTANT;
			a--;
		}
		
		double aSquared = a * a;
		
		double arcTangent = aSquared + 1.4087812;
		arcTangent = 0.55913709 / arcTangent;
		arcTangent += 0.60310578999999997;
		arcTangent -= 0.051604539999999997 * aSquared;
		arcTangent *= a;
		
		for ( ; i > 0; i-- )
		{
			arcTangent += PIover6;
		}
		
		if ( greaterThanOne )
		{
			arcTangent = PIover2 - arcTangent;
		}
		
		if ( negative )
		{
			arcTangent = -arcTangent;
		}
		
		return arcTangent;
	}
	
	/**
	 * Converts rectangular coordinates (x, y) to polar (r, <i>theta</i>).  This method
	 * computes the phase <i>theta</i> by computing an arc tangent of y/x in the range
	 * of <i>-pi</i> to <i>pi</i>.  Special cases:
	 * <ul>
	 *  <li>If either argument is <code>NaN</code>, then the result is <code>NaN</code>.
	 *  <li>If the first argument is positive zero and the second argument is
	 *      positive, or the first argument is positive and finite and the second
	 *      argument is positive infinity, then the result is positive zero.
	 *  <li>If the first argument is negative zero and the second argument is
	 *      positive, or the first argument is negative and finite and the second
	 *      argument is positive infinity, then the result is negative zero.
	 *  <li>If the first argument is positive zero and the second argument is 
	 *      negative, or the first argument is positive and finite and the second
	 *      argument is negative infinity, then the result is the <code>double</code> value 
	 *      closest to <i>pi</i>.
	 *  <li>If the first argument is negative zero and the second argument is 
	 *      negative, or the first argument is negative and finite and the second
	 *      argument is negative infinity, then the result is the <code>double</code> value
	 *      closest to <i>-pi</i>.
	 *  <li>If the first argument is positive and the second argument is positive
	 *      zero or negative zero, or the first argument is positive infinity and
	 *      the second argument is finite, then the result is the <code>double</code> value 
	 *      closest to <i>pi</i>/2.
	 *  <li>If the first argument is negative and the second argument is positive
	 *      zero or negative zero, or the first argument is negative infinity and
	 *      the second argument is finite, then the result is the <code>double</code> value
	 *      closest to <i>-pi</i>/2.
	 *  <li>If both arguments are positive infinity, then the result is the double
	 *      value closest to <i>pi</i>/4.
	 *  <li>If the first argument is positive infinity and the second argument is
	 *      negative infinity, then the result is the double value closest to 3*<i>pi</i>/4.
	 *  <li>If the first argument is negative infinity and the second argument is
	 *      positive infinity, then the result is the double value closest to -<i>pi</i>/4.
	 *  <li>If both arguments are negative infinity, then the result is the double
	 *      value closest to -3*<i>pi</i>/4.
	 * </ul>
	 * <p>
	 * A result must be within 2 ulps of the correctly rounded result.  Results
	 * must be semi-monotonic.
	 * 
	 * @param y - the ordinate coordinate
	 * @param x - the abscissa coordinate 
	 * @return the <i>theta</i> component of the point (r, <i>theta</i>) in polar
	 *   coordinates that corresponds to the point (x, y) in Cartesian coordinates.
	 */
	public static double atan2 (double y, double x)
	{
		// Special cases.
		if ( Double.isNaN(y) || Double.isNaN(x) )
		{
			return Double.NaN;
		}
		else if ( Double.isInfinite(y) )
		{
			if ( y > 0.0 ) // Positive infinity
			{
				if ( Double.isInfinite(x) )
				{
					if ( x > 0.0 )
					{
						return PIover4;
					}
					else
					{
						return 3.0 * PIover4;
					}
				}
				else if ( x != 0.0 )
				{
					return PIover2;
				}
			}
			else  // Negative infinity
			{
				if ( Double.isInfinite(x) )
				{
					if ( x > 0.0 )
					{
						return -PIover4;
					}
					else
					{
						return -3.0 * PIover4;
					}
				}
				else if ( x != 0.0 )
				{
					return -PIover2;
				}
			}
		}
		else if ( y == 0.0 )
		{
			if ( x > 0.0 )
			{
				return y;
			}
			else if ( x < 0.0 )
			{
				return Math.PI;
			}
		}
		else if ( Double.isInfinite(x) )
		{
			if ( x > 0.0 )  // Positive infinity
			{
				if ( y > 0.0 )
				{
					return 0.0;
				}
				else if ( y < 0.0 )
				{
					return -0.0;
				}
			}
			else  // Negative infinity
			{
				if ( y > 0.0 )
				{
					return Math.PI;
				}
				else if ( y < 0.0 )
				{
					return -Math.PI;
				}
			}
		}
		else if ( x == 0.0 )
		{
			if ( y > 0.0 )
			{
				return PIover2;
			}
			else if ( y < 0.0 )
			{
				return -PIover2;
			}
		}
		

		// Implementation a simple version ported from a PASCAL implementation:
		//   http://everything2.com/index.pl?node_id=1008481
		
		double arcTangent;
		
		// Use arctan() avoiding division by zero.
		if ( Math.abs(x) > Math.abs(y) )
		{
			arcTangent = atan(y / x);
		}
		else
		{
			arcTangent = atan(x / y); // -PI/4 <= a <= PI/4

			if ( arcTangent < 0 )
			{
				arcTangent = -PIover2 - arcTangent; // a is negative, so we're adding
			}
			else
			{
				arcTangent = PIover2 - arcTangent;
			}
		}
		
		// Adjust result to be from [-PI, PI]
		if ( x < 0 )
		{
			if ( y < 0 )
			{
				arcTangent = arcTangent - Math.PI;
			}
			else
			{
				arcTangent = arcTangent + Math.PI;
			}
		}
		
		return arcTangent;
	}

	/**
	 * Returns the closest <code>int</code> to the argument. The 
	 * result is rounded to an integer by adding 1/2, taking the 
	 * floor of the result, and casting the result to type <code>int</code>. 
	 * In other words, the result is equal to the value of the expression:
	 * <p>
	 * <pre>(int)Math.floor(a + 0.5f)</pre>
	 * <p>
	 * Special cases:
	 * <ul>
	 *  <li>If the argument is NaN, the result is 0.
	 *  <li>If the argument is negative infinity or any value less than or 
	 *      equal to the value of <code>Integer.MIN_VALUE</code>, the result is 
	 *      equal to the value of <code>Integer.MIN_VALUE</code>. 
	 *  <li>If the argument is positive infinity or any value greater than or 
	 *      equal to the value of <code>Integer.MAX_VALUE</code>, the result is 
	 *      equal to the value of <code>Integer.MAX_VALUE</code>.
	 * </ul> 
	 *
	 * @param  a - a floating-point value to be rounded to an integer.
	 * @return the value of the argument rounded to the nearest <code>int</code> value.
	 */
	public static int round (float a)
	{
		return (int)Math.floor( a + 0.5f );
	}

	/**
	 * Returns the closest <code>long</code> to the argument. The result 
	 * is rounded to an integer by adding 1/2, taking the floor of the 
	 * result, and casting the result to type <code>long</code>. In other 
	 * words, the result is equal to the value of the expression:
	 * <p>
	 * <pre>(long)Math.floor(a + 0.5d)</pre>
	 * <p>
	 * Special cases:
	 * <ul>
	 *  <li>If the argument is NaN, the result is 0.
	 *  <li>If the argument is negative infinity or any value less than or 
	 *      equal to the value of <code>Long.MIN_VALUE</code>, the result is 
	 *      equal to the value of <code>Long.MIN_VALUE</code>. 
	 *  <li>If the argument is positive infinity or any value greater than or 
	 *      equal to the value of <code>Long.MAX_VALUE</code>, the result is 
	 *      equal to the value of <code>Long.MAX_VALUE</code>.
	 * </ul> 
	 *
	 * @param a - a floating-point value to be rounded to a <code>long</code>.
	 * @return the value of the argument rounded to the nearest <code>long</code> value.
	 */
	public static long round (double a)
	{
		return (long)Math.floor( a + 0.5 );
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美在线999| 国产精品卡一卡二| 亚洲欧洲三级电影| 日本va欧美va瓶| 色哟哟日韩精品| 久久综合狠狠综合| 亚洲成人黄色小说| 99久久精品国产网站| 欧美一区二区三区四区视频| 亚洲女厕所小便bbb| 精品无人区卡一卡二卡三乱码免费卡| 91在线码无精品| 国产精品视频第一区| 国产乱色国产精品免费视频| 91麻豆精品国产综合久久久久久| 中文字幕在线观看不卡视频| 国产麻豆日韩欧美久久| 日韩美女主播在线视频一区二区三区| 一区二区三区色| 国产99精品在线观看| 精品粉嫩超白一线天av| 日韩中文字幕一区二区三区| 欧美日韩中文另类| 亚洲一区二三区| 欧美性生活一区| 亚洲高清视频在线| 日本高清不卡aⅴ免费网站| 亚洲欧洲精品天堂一级| 99久久久精品免费观看国产蜜| 久久女同精品一区二区| 国内精品写真在线观看| 欧美精品一区二区三区在线| 麻豆高清免费国产一区| 91精品国产综合久久小美女| 免费人成网站在线观看欧美高清| 欧美日韩在线三区| 蜜桃久久久久久久| 欧美成人高清电影在线| 国产一区二区在线看| 国产丝袜在线精品| 9色porny自拍视频一区二区| 国产精品国产成人国产三级| 在线观看成人免费视频| 天天射综合影视| 精品日韩99亚洲| 国产大片一区二区| 中文字幕一区二区三区不卡| 在线免费观看不卡av| 亚洲bt欧美bt精品| 精品国产一二三区| 99这里都是精品| 亚洲一区二区影院| 日韩精品中文字幕一区| 国产精品一区二区三区乱码| 一色桃子久久精品亚洲| 欧美日韩一区二区三区免费看| 免费高清不卡av| 欧美高清在线一区| 欧美私模裸体表演在线观看| 久久精品国产一区二区| 久久久久国产精品免费免费搜索| av电影在线不卡| 蜜桃在线一区二区三区| 综合色天天鬼久久鬼色| 51精品视频一区二区三区| 国产一区二区三区最好精华液| 国产精品久久久久久亚洲伦| 在线成人高清不卡| 高清在线观看日韩| 亚洲成a天堂v人片| 国产精品久久毛片| 日韩欧美精品三级| 91丨九色丨尤物| 精久久久久久久久久久| 夜夜嗨av一区二区三区中文字幕| 欧美tk—视频vk| 欧美性大战xxxxx久久久| 麻豆精品久久精品色综合| 亚洲美女淫视频| 国产免费成人在线视频| 日韩一区二区在线播放| 91美女福利视频| 国产99一区视频免费| 麻豆91精品视频| 亚洲高清视频在线| 亚洲女同女同女同女同女同69| 日韩一卡二卡三卡四卡| 91电影在线观看| 成人白浆超碰人人人人| 久久精品噜噜噜成人av农村| 亚洲主播在线观看| 亚洲免费大片在线观看| 中文无字幕一区二区三区| 欧美成人精品二区三区99精品| 欧美午夜精品一区| 色吊一区二区三区| 91美女在线视频| 99精品1区2区| 成人亚洲一区二区一| 国产一区二区三区四区在线观看| 日韩在线一区二区三区| 亚洲一区二区美女| 一区二区三区在线播| 中文字幕亚洲不卡| 国产精品毛片大码女人| 日本一区二区视频在线观看| 欧美精品一区二区三区高清aⅴ| 在线不卡欧美精品一区二区三区| 欧美在线一区二区三区| 欧美亚洲国产一区二区三区va | 国产精品久久久久精k8| 久久综合久久99| 久久亚洲影视婷婷| 久久免费精品国产久精品久久久久| 日韩午夜中文字幕| www久久久久| 国产精品免费丝袜| 亚洲婷婷综合久久一本伊一区| 亚洲视频 欧洲视频| 亚洲男人的天堂在线aⅴ视频| 中文字幕一区二区不卡| 亚洲精品老司机| 五月天激情小说综合| 青青草国产精品97视觉盛宴 | 欧美一区二区三区喷汁尤物| 91精品国产色综合久久| 精品久久久久久久久久久久久久久久久 | av成人老司机| 欧美色视频在线| 日韩网站在线看片你懂的| 欧美va在线播放| 国产精品蜜臀在线观看| 亚洲精品视频一区二区| 亚洲一级在线观看| 国内外成人在线视频| 成人av网在线| 欧美日韩国产美女| 久久久精品欧美丰满| 亚洲欧洲性图库| 日本一区中文字幕| 国产成人aaa| 在线观看网站黄不卡| 欧美哺乳videos| 中文字幕佐山爱一区二区免费| 一片黄亚洲嫩模| 久久激五月天综合精品| www.99精品| 日韩一本二本av| 中文字幕一区二区三区四区| 日韩福利电影在线观看| 国产成人激情av| 欧美丰满高潮xxxx喷水动漫| 欧美国产日本视频| 午夜精品久久久久久不卡8050| 国产精品一线二线三线精华| 在线看国产一区| 国产欧美精品一区二区色综合| 一区二区三区高清在线| 国产自产v一区二区三区c| 欧美在线综合视频| 中文字幕第一区二区| 奇米综合一区二区三区精品视频| 福利电影一区二区| 日韩欧美国产三级| 亚洲综合色丁香婷婷六月图片| 狠狠色丁香婷婷综合久久片| 欧美三级视频在线观看| 国产精品乱人伦中文| 麻豆精品蜜桃视频网站| 欧美日韩精品一区二区三区四区| 日本一区二区三区在线观看| 老司机免费视频一区二区| 日韩精品一区二区在线| 一区二区三区在线免费| 懂色av一区二区在线播放| 日韩美女视频在线| 首页亚洲欧美制服丝腿| 99视频一区二区| 欧美精品一区二区三区在线播放| 日韩二区在线观看| 欧美日韩亚洲另类| 一区二区三区四区不卡视频| 99久久久久久| 亚洲欧洲一区二区在线播放| 成人毛片视频在线观看| 久久精品一区二区| 国产揄拍国内精品对白| 日韩午夜电影av| 蜜臀久久99精品久久久画质超高清 | 婷婷中文字幕综合| 欧美三级视频在线观看| 亚洲一区二区三区四区五区黄| 色综合天天性综合| 中文字幕日本不卡| 99精品欧美一区二区三区小说| 久久精品视频网| 高清视频一区二区| 中文字幕二三区不卡| 99热精品国产| 伊人婷婷欧美激情|