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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? mathfunc.java

?? 關(guān)于J4ME J2ME實例
?? 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 );
	}
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91免费国产在线| 视频一区免费在线观看| 成人的网站免费观看| 国产精品视频线看| 成人国产精品免费网站| 中文字幕中文字幕一区二区| 91一区二区在线| 日本免费在线视频不卡一不卡二| 欧美三级韩国三级日本三斤| 日韩中文字幕91| 久久尤物电影视频在线观看| 岛国一区二区在线观看| 亚洲视频狠狠干| 欧美一级精品大片| 国产成人精品免费视频网站| 亚洲免费av网站| 欧美一区二区在线免费播放| 久久精品免费看| 国产精品久久久久影院亚瑟| 欧美性猛交一区二区三区精品| 蜜桃视频第一区免费观看| 国产午夜一区二区三区| 日本丶国产丶欧美色综合| 青青草精品视频| 国产精品嫩草影院com| 欧美日韩一级视频| 国产又黄又大久久| 亚洲一区视频在线观看视频| 日韩欧美www| 99精品视频一区| 免费观看久久久4p| 中文字幕一区二| 日韩精品中文字幕一区| 成人激情免费网站| 免费观看一级特黄欧美大片| 国产精品久久夜| 日韩一区二区三区三四区视频在线观看 | 欧美精品久久一区| 国产成人午夜电影网| 亚洲一区在线观看视频| 国产三级欧美三级| 欧美三级视频在线播放| 福利一区二区在线| 日韩精品亚洲专区| 亚洲免费色视频| 久久精品欧美日韩| 91麻豆精品国产91久久久久久| 成人av免费网站| 美女在线观看视频一区二区| 一区二区三区精品在线| 久久精品在线免费观看| 日韩视频123| 欧美综合天天夜夜久久| caoporn国产精品| 精品一区中文字幕| 天天综合色天天综合| 一区二区三区在线视频播放| 国产女主播一区| 精品国产露脸精彩对白| 欧美一级片免费看| 欧美日韩精品一区二区三区四区| eeuss鲁一区二区三区| 国产精品亚洲第一| 国产在线视频不卡二| 蜜桃视频在线一区| 美女久久久精品| 天堂蜜桃91精品| 亚洲高清久久久| 亚洲高清免费在线| 亚洲成年人影院| 亚洲国产综合在线| 亚洲成人免费观看| 亚洲成人在线免费| 性做久久久久久久免费看| 国产在线精品免费av| 狂野欧美性猛交blacked| 美女视频黄频大全不卡视频在线播放| 亚洲国产精品久久不卡毛片| 亚洲国产日韩av| 亚洲国产综合在线| 天天综合色天天综合| 婷婷国产在线综合| 久久精品国产久精国产| 久久99精品久久久久久| 久草精品在线观看| 国产精品主播直播| eeuss鲁片一区二区三区在线看| 福利视频网站一区二区三区| 成人高清免费在线播放| 色婷婷av一区二区| 欧洲亚洲精品在线| 欧美一卡二卡三卡| 国产午夜亚洲精品午夜鲁丝片| 中文文精品字幕一区二区| 中文字幕一区二区三区乱码在线| 亚洲欧美日韩国产成人精品影院| 一区二区三区中文在线观看| 亚洲国产aⅴ天堂久久| 蜜臀av性久久久久蜜臀aⅴ流畅| 九色|91porny| 99国产精品国产精品毛片| 在线观看国产日韩| 精品免费一区二区三区| 中文字幕欧美区| 亚洲综合在线视频| 免费高清在线视频一区·| 国产91精品一区二区| 色婷婷久久久综合中文字幕| 3d成人h动漫网站入口| 久久久久97国产精华液好用吗| 亚洲欧洲精品天堂一级 | 国产日本欧美一区二区| 亚洲女同一区二区| 精品无码三级在线观看视频| 91丨九色丨国产丨porny| 欧美老女人在线| 久久综合99re88久久爱| 亚洲人成网站影音先锋播放| 午夜不卡av在线| 懂色av中文字幕一区二区三区| 在线视频你懂得一区| 久久精品人人做人人爽人人| 亚洲自拍偷拍麻豆| 成人三级伦理片| 欧美高清激情brazzers| 午夜精品久久久久久久久久久| 日本欧美一区二区| 91福利视频在线| 国产亚洲欧美在线| 琪琪久久久久日韩精品| 91麻豆蜜桃一区二区三区| 精品国产乱码久久久久久浪潮| 亚洲女性喷水在线观看一区| 精品系列免费在线观看| 欧美又粗又大又爽| 国产精品久久久久久久久晋中 | 国产性色一区二区| 日韩和的一区二区| 一本在线高清不卡dvd| 久久精品亚洲国产奇米99| 午夜伦欧美伦电影理论片| 成人免费看的视频| 精品久久久久一区| 爽好多水快深点欧美视频| 91原创在线视频| 国产亚洲制服色| 九九精品视频在线看| 欧美午夜电影在线播放| 亚洲人成人一区二区在线观看| 国产成人在线网站| 欧美精品一区二区三区高清aⅴ | 欧美日韩亚洲综合在线 | 精品国产一区二区三区久久久蜜月 | 欧美日韩精品电影| 亚洲特级片在线| 成人免费毛片嘿嘿连载视频| www久久精品| 久久超碰97中文字幕| 欧美一级黄色片| 青草av.久久免费一区| 欧美精品日韩一本| 亚洲影院免费观看| 欧美中文字幕一区| 一二三区精品福利视频| 欧美性猛交xxxxxxxx| 亚洲青青青在线视频| av网站免费线看精品| 亚洲色图一区二区三区| 色综合网色综合| 亚洲色图在线看| 欧美性大战xxxxx久久久| 亚洲国产你懂的| 欧美日韩视频在线观看一区二区三区 | 91久久精品一区二区三| 亚洲色图在线看| 欧美吞精做爰啪啪高潮| 亚洲国产精品尤物yw在线观看| 欧美专区日韩专区| 日本三级韩国三级欧美三级| 欧美一区二区视频观看视频| 日韩精品成人一区二区三区| 欧美一级理论片| 国产丶欧美丶日本不卡视频| 欧美国产精品中文字幕| 99久久精品国产一区| 亚洲一区二区三区四区五区中文 | 精品少妇一区二区| 国模少妇一区二区三区| 国产精品久久久久久福利一牛影视| 成人av电影免费在线播放| 亚洲免费观看视频| 日韩一区二区三区三四区视频在线观看 | 26uuu国产日韩综合| 不卡免费追剧大全电视剧网站| 亚洲人成精品久久久久| 88在线观看91蜜桃国自产| 韩国av一区二区| 亚洲最新视频在线观看| 精品999久久久| 一本大道综合伊人精品热热|