You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by nd...@apache.org on 2009/10/12 02:08:41 UTC
svn commit: r824204 -
/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/StrictMath.java
Author: ndbeyer
Date: Mon Oct 12 00:08:41 2009
New Revision: 824204
URL: http://svn.apache.org/viewvc?rev=824204&view=rev
Log:
convert tabs to spaces - no functional changes
Modified:
harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/StrictMath.java
Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/StrictMath.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/StrictMath.java?rev=824204&r1=824203&r2=824204&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/StrictMath.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/StrictMath.java Mon Oct 12 00:08:41 2009
@@ -38,26 +38,26 @@
*/
public final class StrictMath {
- /**
+ /**
* The double value closest to e, the base of the natural logarithm.
- */
- public final static double E = Math.E;
+ */
+ public final static double E = Math.E;
- /**
+ /**
* The double value closest to pi, the ratio of a circle's circumference to
* its diameter.
- */
- public final static double PI = Math.PI;
+ */
+ public final static double PI = Math.PI;
- private static java.util.Random random;
+ private static java.util.Random random;
- /**
- * Prevents this class from being instantiated.
- */
- private StrictMath() {
- }
+ /**
+ * Prevents this class from being instantiated.
+ */
+ private StrictMath() {
+ }
- /**
+ /**
* Returns the absolute value of the argument.
* <p>
* Special cases:
@@ -72,11 +72,11 @@
* the value whose absolute value has to be computed.
* @return the absolute value of the argument.
*/
- public static double abs(double d) {
- long bits = Double.doubleToLongBits(d);
- bits &= 0x7fffffffffffffffL;
- return Double.longBitsToDouble(bits);
- }
+ public static double abs(double d) {
+ long bits = Double.doubleToLongBits(d);
+ bits &= 0x7fffffffffffffffL;
+ return Double.longBitsToDouble(bits);
+ }
/**
* Returns the absolute value of the argument.
@@ -94,11 +94,11 @@
* @return the argument if it is positive, otherwise the negation of the
* argument.
*/
- public static float abs(float f) {
- int bits = Float.floatToIntBits(f);
- bits &= 0x7fffffff;
- return Float.intBitsToFloat(bits);
- }
+ public static float abs(float f) {
+ int bits = Float.floatToIntBits(f);
+ bits &= 0x7fffffff;
+ return Float.intBitsToFloat(bits);
+ }
/**
* Returns the absolute value of the argument.
@@ -111,9 +111,9 @@
* @return the argument if it is positive, otherwise the negation of the
* argument.
*/
- public static int abs(int i) {
- return i >= 0 ? i : -i;
- }
+ public static int abs(int i) {
+ return i >= 0 ? i : -i;
+ }
/**
* Returns the absolute value of the argument.
@@ -126,9 +126,9 @@
* @return the argument if it is positive, otherwise the negation of the
* argument.
*/
- public static long abs(long l) {
- return l >= 0 ? l : -l;
- }
+ public static long abs(long l) {
+ return l >= 0 ? l : -l;
+ }
/**
* Returns the closest double approximation of the arc cosine of the
@@ -145,7 +145,7 @@
* the value to compute arc cosine of.
* @return the arc cosine of the argument.
*/
- public static native double acos(double d);
+ public static native double acos(double d);
/**
* Returns the closest double approximation of the arc sine of the argument
@@ -162,7 +162,7 @@
* the value whose arc sine has to be computed.
* @return the arc sine of the argument.
*/
- public static native double asin(double d);
+ public static native double asin(double d);
/**
* Returns the closest double approximation of the arc tangent of the
@@ -181,7 +181,7 @@
* the value whose arc tangent has to be computed.
* @return the arc tangent of the argument.
*/
- public static native double atan(double d);
+ public static native double atan(double d);
/**
* Returns the closest double approximation of the arc tangent of
@@ -220,7 +220,7 @@
* the denominator of the value whose atan has to be computed.
* @return the arc tangent of {@code y/x}.
*/
- public static native double atan2(double y, double x);
+ public static native double atan2(double y, double x);
/**
* Returns the closest double approximation of the cube root of the
@@ -259,7 +259,7 @@
* the value whose closest integer value has to be computed.
* @return the ceiling of the argument.
*/
- public static native double ceil(double d);
+ public static native double ceil(double d);
/**
@@ -402,7 +402,7 @@
* the denominator of the operation.
* @return the IEEE754 floating point reminder of of {@code x/y}.
*/
- public static native double IEEEremainder(double x, double y);
+ public static native double IEEEremainder(double x, double y);
/**
* Returns the closest double approximation of the natural logarithm of the
@@ -485,20 +485,20 @@
* the second argument.
* @return the larger of {@code d1} and {@code d2}.
*/
- public static double max(double d1, double d2) {
- if (d1 > d2)
- return d1;
- if (d1 < d2)
- return d2;
- /* if either arg is NaN, return NaN */
- if (d1 != d2)
- return Double.NaN;
- /* max( +0.0,-0.0) == +0.0 */
- if (d1 == 0.0
- && ((Double.doubleToLongBits(d1) & Double.doubleToLongBits(d2)) & 0x8000000000000000L) == 0)
- return 0.0;
- return d1;
- }
+ public static double max(double d1, double d2) {
+ if (d1 > d2)
+ return d1;
+ if (d1 < d2)
+ return d2;
+ /* if either arg is NaN, return NaN */
+ if (d1 != d2)
+ return Double.NaN;
+ /* max( +0.0,-0.0) == +0.0 */
+ if (d1 == 0.0
+ && ((Double.doubleToLongBits(d1) & Double.doubleToLongBits(d2)) & 0x8000000000000000L) == 0)
+ return 0.0;
+ return d1;
+ }
/**
* Returns the most positive (closest to positive infinity) of the two
@@ -518,20 +518,20 @@
* the second argument.
* @return the larger of {@code f1} and {@code f2}.
*/
- public static float max(float f1, float f2) {
- if (f1 > f2)
- return f1;
- if (f1 < f2)
- return f2;
- /* if either arg is NaN, return NaN */
- if (f1 != f2)
- return Float.NaN;
- /* max( +0.0,-0.0) == +0.0 */
- if (f1 == 0.0f
- && ((Float.floatToIntBits(f1) & Float.floatToIntBits(f2)) & 0x80000000) == 0)
- return 0.0f;
- return f1;
- }
+ public static float max(float f1, float f2) {
+ if (f1 > f2)
+ return f1;
+ if (f1 < f2)
+ return f2;
+ /* if either arg is NaN, return NaN */
+ if (f1 != f2)
+ return Float.NaN;
+ /* max( +0.0,-0.0) == +0.0 */
+ if (f1 == 0.0f
+ && ((Float.floatToIntBits(f1) & Float.floatToIntBits(f2)) & 0x80000000) == 0)
+ return 0.0f;
+ return f1;
+ }
/**
* Returns the most positive (closest to positive infinity) of the two
@@ -543,9 +543,9 @@
* the second argument.
* @return the larger of {@code i1} and {@code i2}.
*/
- public static int max(int i1, int i2) {
- return i1 > i2 ? i1 : i2;
- }
+ public static int max(int i1, int i2) {
+ return i1 > i2 ? i1 : i2;
+ }
/**
* Returns the most positive (closest to positive infinity) of the two
@@ -557,9 +557,9 @@
* the second argument.
* @return the larger of {@code l1} and {@code l2}.
*/
- public static long max(long l1, long l2) {
- return l1 > l2 ? l1 : l2;
- }
+ public static long max(long l1, long l2) {
+ return l1 > l2 ? l1 : l2;
+ }
/**
* Returns the most negative (closest to negative infinity) of the two
@@ -579,20 +579,20 @@
* the second argument.
* @return the smaller of {@code d1} and {@code d2}.
*/
- public static double min(double d1, double d2) {
- if (d1 > d2)
- return d2;
- if (d1 < d2)
- return d1;
- /* if either arg is NaN, return NaN */
- if (d1 != d2)
- return Double.NaN;
- /* min( +0.0,-0.0) == -0.0 */
- if (d1 == 0.0
- && ((Double.doubleToLongBits(d1) | Double.doubleToLongBits(d2)) & 0x8000000000000000l) != 0)
- return 0.0 * (-1.0);
- return d1;
- }
+ public static double min(double d1, double d2) {
+ if (d1 > d2)
+ return d2;
+ if (d1 < d2)
+ return d1;
+ /* if either arg is NaN, return NaN */
+ if (d1 != d2)
+ return Double.NaN;
+ /* min( +0.0,-0.0) == -0.0 */
+ if (d1 == 0.0
+ && ((Double.doubleToLongBits(d1) | Double.doubleToLongBits(d2)) & 0x8000000000000000l) != 0)
+ return 0.0 * (-1.0);
+ return d1;
+ }
/**
* Returns the most negative (closest to negative infinity) of the two
@@ -612,20 +612,20 @@
* the second argument.
* @return the smaller of {@code f1} and {@code f2}.
*/
- public static float min(float f1, float f2) {
- if (f1 > f2)
- return f2;
- if (f1 < f2)
- return f1;
- /* if either arg is NaN, return NaN */
- if (f1 != f2)
- return Float.NaN;
- /* min( +0.0,-0.0) == -0.0 */
- if (f1 == 0.0f
- && ((Float.floatToIntBits(f1) | Float.floatToIntBits(f2)) & 0x80000000) != 0)
- return 0.0f * (-1.0f);
- return f1;
- }
+ public static float min(float f1, float f2) {
+ if (f1 > f2)
+ return f2;
+ if (f1 < f2)
+ return f1;
+ /* if either arg is NaN, return NaN */
+ if (f1 != f2)
+ return Float.NaN;
+ /* min( +0.0,-0.0) == -0.0 */
+ if (f1 == 0.0f
+ && ((Float.floatToIntBits(f1) | Float.floatToIntBits(f2)) & 0x80000000) != 0)
+ return 0.0f * (-1.0f);
+ return f1;
+ }
/**
* Returns the most negative (closest to negative infinity) of the two
@@ -637,9 +637,9 @@
* the second argument.
* @return the smaller of {@code i1} and {@code i2}.
*/
- public static int min(int i1, int i2) {
- return i1 < i2 ? i1 : i2;
- }
+ public static int min(int i1, int i2) {
+ return i1 < i2 ? i1 : i2;
+ }
/**
* Returns the most negative (closest to negative infinity) of the two
@@ -651,9 +651,9 @@
* the second argument.
* @return the smaller of {@code l1} and {@code l2}.
*/
- public static long min(long l1, long l2) {
- return l1 < l2 ? l1 : l2;
- }
+ public static long min(long l1, long l2) {
+ return l1 < l2 ? l1 : l2;
+ }
/**
* Returns the closest double approximation of the result of raising
@@ -693,7 +693,7 @@
* the exponent of the operation.
* @return {@code x} to the power of {@code y}.
*/
- public static native double pow(double x, double y);
+ public static native double pow(double x, double y);
/**
* Returns a pseudo-random number between 0.0 (inclusive) and 1.0
@@ -702,10 +702,10 @@
* @return a pseudo-random number.
*/
public static double random() {
- if (random == null)
- random = new Random();
- return random.nextDouble();
- }
+ if (random == null)
+ random = new Random();
+ return random.nextDouble();
+ }
/**
* Returns the double conversion of the result of rounding the argument to
@@ -745,12 +745,12 @@
* the value to be rounded.
* @return the closest integer to the argument.
*/
- public static long round(double d) {
- // check for NaN
- if (d != d)
- return 0L;
- return (long) Math.floor(d + 0.5d);
- }
+ public static long round(double d) {
+ // check for NaN
+ if (d != d)
+ return 0L;
+ return (long) Math.floor(d + 0.5d);
+ }
/**
* Returns the result of rounding the argument to an integer. The result is
@@ -771,12 +771,12 @@
* the value to be rounded.
* @return the closest integer to the argument.
*/
- public static int round(float f) {
- // check for NaN
- if (f != f)
- return 0;
- return (int) Math.floor(f + 0.5f);
- }
+ public static int round(float f) {
+ // check for NaN
+ if (f != f)
+ return 0;
+ return (int) Math.floor(f + 0.5f);
+ }
/**
* Returns the signum function of the argument. If the argument is less than
@@ -952,9 +952,9 @@
* an angle in radians.
* @return the degree measure of the angle.
*/
- public static double toDegrees(double angrad) {
- return angrad * 180d / PI;
- }
+ public static double toDegrees(double angrad) {
+ return angrad * 180d / PI;
+ }
/**
* Returns the measure in radians of the supplied degree angle. The result
@@ -973,11 +973,11 @@
* an angle in degrees.
* @return the radian measure of the angle.
*/
- public static double toRadians(double angdeg) {
- return angdeg / 180d * PI;
- }
-
- /**
+ public static double toRadians(double angdeg) {
+ return angdeg / 180d * PI;
+ }
+
+ /**
* Returns the argument's ulp (unit in the last place). The size of a ulp of
* a double value is the positive distance between this value and the double
* value next larger in magnitude. For non-NaN {@code x},