emul/src/main/java/java/lang/Math.java
branchemul
changeset 84 d65b3a2fbfaf
parent 67 cc0d42d2110a
child 104 1376481f15e7
     1.1 --- a/emul/src/main/java/java/lang/Math.java	Sat Sep 29 10:56:23 2012 +0200
     1.2 +++ b/emul/src/main/java/java/lang/Math.java	Sun Sep 30 18:29:37 2012 -0700
     1.3 @@ -24,7 +24,6 @@
     1.4   */
     1.5  
     1.6  package java.lang;
     1.7 -import java.util.Random;
     1.8  
     1.9  
    1.10  /**
    1.11 @@ -680,12 +679,12 @@
    1.12              return 0;
    1.13      }
    1.14  
    1.15 -    private static Random randomNumberGenerator;
    1.16 -
    1.17 -    private static synchronized Random initRNG() {
    1.18 -        Random rnd = randomNumberGenerator;
    1.19 -        return (rnd == null) ? (randomNumberGenerator = new Random()) : rnd;
    1.20 -    }
    1.21 +//    private static Random randomNumberGenerator;
    1.22 +//
    1.23 +//    private static synchronized Random initRNG() {
    1.24 +//        Random rnd = randomNumberGenerator;
    1.25 +//        return (rnd == null) ? (randomNumberGenerator = new Random()) : rnd;
    1.26 +//    }
    1.27  
    1.28      /**
    1.29       * Returns a {@code double} value with a positive sign, greater
    1.30 @@ -711,9 +710,7 @@
    1.31       * @see Random#nextDouble()
    1.32       */
    1.33      public static double random() {
    1.34 -        Random rnd = randomNumberGenerator;
    1.35 -        if (rnd == null) rnd = initRNG();
    1.36 -        return rnd.nextDouble();
    1.37 +        throw new UnsupportedOperationException();
    1.38      }
    1.39  
    1.40      /**
    1.41 @@ -962,9 +959,9 @@
    1.42       * @author Joseph D. Darcy
    1.43       * @since 1.5
    1.44       */
    1.45 -    public static double ulp(double d) {
    1.46 -        return sun.misc.FpUtils.ulp(d);
    1.47 -    }
    1.48 +//    public static double ulp(double d) {
    1.49 +//        return sun.misc.FpUtils.ulp(d);
    1.50 +//    }
    1.51  
    1.52      /**
    1.53       * Returns the size of an ulp of the argument.  An ulp of a
    1.54 @@ -989,9 +986,9 @@
    1.55       * @author Joseph D. Darcy
    1.56       * @since 1.5
    1.57       */
    1.58 -    public static float ulp(float f) {
    1.59 -        return sun.misc.FpUtils.ulp(f);
    1.60 -    }
    1.61 +//    public static float ulp(float f) {
    1.62 +//        return sun.misc.FpUtils.ulp(f);
    1.63 +//    }
    1.64  
    1.65      /**
    1.66       * Returns the signum function of the argument; zero if the argument
    1.67 @@ -1010,9 +1007,9 @@
    1.68       * @author Joseph D. Darcy
    1.69       * @since 1.5
    1.70       */
    1.71 -    public static double signum(double d) {
    1.72 -        return sun.misc.FpUtils.signum(d);
    1.73 -    }
    1.74 +//    public static double signum(double d) {
    1.75 +//        return sun.misc.FpUtils.signum(d);
    1.76 +//    }
    1.77  
    1.78      /**
    1.79       * Returns the signum function of the argument; zero if the argument
    1.80 @@ -1031,9 +1028,9 @@
    1.81       * @author Joseph D. Darcy
    1.82       * @since 1.5
    1.83       */
    1.84 -    public static float signum(float f) {
    1.85 -        return sun.misc.FpUtils.signum(f);
    1.86 -    }
    1.87 +//    public static float signum(float f) {
    1.88 +//        return sun.misc.FpUtils.signum(f);
    1.89 +//    }
    1.90  
    1.91      /**
    1.92       * Returns the hyperbolic sine of a {@code double} value.
    1.93 @@ -1251,9 +1248,9 @@
    1.94       * and the sign of {@code sign}.
    1.95       * @since 1.6
    1.96       */
    1.97 -    public static double copySign(double magnitude, double sign) {
    1.98 -        return sun.misc.FpUtils.rawCopySign(magnitude, sign);
    1.99 -    }
   1.100 +//    public static double copySign(double magnitude, double sign) {
   1.101 +//        return sun.misc.FpUtils.rawCopySign(magnitude, sign);
   1.102 +//    }
   1.103  
   1.104      /**
   1.105       * Returns the first floating-point argument with the sign of the
   1.106 @@ -1270,9 +1267,9 @@
   1.107       * and the sign of {@code sign}.
   1.108       * @since 1.6
   1.109       */
   1.110 -    public static float copySign(float magnitude, float sign) {
   1.111 -        return sun.misc.FpUtils.rawCopySign(magnitude, sign);
   1.112 -    }
   1.113 +//    public static float copySign(float magnitude, float sign) {
   1.114 +//        return sun.misc.FpUtils.rawCopySign(magnitude, sign);
   1.115 +//    }
   1.116  
   1.117      /**
   1.118       * Returns the unbiased exponent used in the representation of a
   1.119 @@ -1288,9 +1285,9 @@
   1.120       * @return the unbiased exponent of the argument
   1.121       * @since 1.6
   1.122       */
   1.123 -    public static int getExponent(float f) {
   1.124 -        return sun.misc.FpUtils.getExponent(f);
   1.125 -    }
   1.126 +//    public static int getExponent(float f) {
   1.127 +//        return sun.misc.FpUtils.getExponent(f);
   1.128 +//    }
   1.129  
   1.130      /**
   1.131       * Returns the unbiased exponent used in the representation of a
   1.132 @@ -1306,9 +1303,9 @@
   1.133       * @return the unbiased exponent of the argument
   1.134       * @since 1.6
   1.135       */
   1.136 -    public static int getExponent(double d) {
   1.137 -        return sun.misc.FpUtils.getExponent(d);
   1.138 -    }
   1.139 +//    public static int getExponent(double d) {
   1.140 +//        return sun.misc.FpUtils.getExponent(d);
   1.141 +//    }
   1.142  
   1.143      /**
   1.144       * Returns the floating-point number adjacent to the first
   1.145 @@ -1350,9 +1347,9 @@
   1.146       * direction of {@code direction}.
   1.147       * @since 1.6
   1.148       */
   1.149 -    public static double nextAfter(double start, double direction) {
   1.150 -        return sun.misc.FpUtils.nextAfter(start, direction);
   1.151 -    }
   1.152 +//    public static double nextAfter(double start, double direction) {
   1.153 +//        return sun.misc.FpUtils.nextAfter(start, direction);
   1.154 +//    }
   1.155  
   1.156      /**
   1.157       * Returns the floating-point number adjacent to the first
   1.158 @@ -1393,9 +1390,9 @@
   1.159       * direction of {@code direction}.
   1.160       * @since 1.6
   1.161       */
   1.162 -    public static float nextAfter(float start, double direction) {
   1.163 -        return sun.misc.FpUtils.nextAfter(start, direction);
   1.164 -    }
   1.165 +//    public static float nextAfter(float start, double direction) {
   1.166 +//        return sun.misc.FpUtils.nextAfter(start, direction);
   1.167 +//    }
   1.168  
   1.169      /**
   1.170       * Returns the floating-point value adjacent to {@code d} in
   1.171 @@ -1422,9 +1419,9 @@
   1.172       * infinity.
   1.173       * @since 1.6
   1.174       */
   1.175 -    public static double nextUp(double d) {
   1.176 -        return sun.misc.FpUtils.nextUp(d);
   1.177 -    }
   1.178 +//    public static double nextUp(double d) {
   1.179 +//        return sun.misc.FpUtils.nextUp(d);
   1.180 +//    }
   1.181  
   1.182      /**
   1.183       * Returns the floating-point value adjacent to {@code f} in
   1.184 @@ -1451,9 +1448,9 @@
   1.185       * infinity.
   1.186       * @since 1.6
   1.187       */
   1.188 -    public static float nextUp(float f) {
   1.189 -        return sun.misc.FpUtils.nextUp(f);
   1.190 -    }
   1.191 +//    public static float nextUp(float f) {
   1.192 +//        return sun.misc.FpUtils.nextUp(f);
   1.193 +//    }
   1.194  
   1.195  
   1.196      /**
   1.197 @@ -1486,9 +1483,9 @@
   1.198       * @return {@code d} &times; 2<sup>{@code scaleFactor}</sup>
   1.199       * @since 1.6
   1.200       */
   1.201 -    public static double scalb(double d, int scaleFactor) {
   1.202 -        return sun.misc.FpUtils.scalb(d, scaleFactor);
   1.203 -    }
   1.204 +//    public static double scalb(double d, int scaleFactor) {
   1.205 +//        return sun.misc.FpUtils.scalb(d, scaleFactor);
   1.206 +//    }
   1.207  
   1.208      /**
   1.209       * Return {@code f} &times;
   1.210 @@ -1520,7 +1517,7 @@
   1.211       * @return {@code f} &times; 2<sup>{@code scaleFactor}</sup>
   1.212       * @since 1.6
   1.213       */
   1.214 -    public static float scalb(float f, int scaleFactor) {
   1.215 -        return sun.misc.FpUtils.scalb(f, scaleFactor);
   1.216 -    }
   1.217 +//    public static float scalb(float f, int scaleFactor) {
   1.218 +//        return sun.misc.FpUtils.scalb(f, scaleFactor);
   1.219 +//    }
   1.220  }