compiler/benchmarks/PPCBenchmarkResources.st
changeset 421 7e08b31e0dae
parent 420 b2f2f15cef26
child 422 116d2b2af905
equal deleted inserted replaced
420:b2f2f15cef26 421:7e08b31e0dae
     2 
     2 
     3 Object subclass:#PPCBenchmarkResources
     3 Object subclass:#PPCBenchmarkResources
     4 	instanceVariableNames:''
     4 	instanceVariableNames:''
     5 	classVariableNames:'javaCache'
     5 	classVariableNames:'javaCache'
     6 	poolDictionaries:''
     6 	poolDictionaries:''
     7 	category:'PetitCompiler-Benchmarks'
     7 	category:'PetitCompiler-Benchmarks-Core'
     8 !
     8 !
     9 
     9 
    10 !PPCBenchmarkResources methodsFor:'as yet unclassified'!
    10 !PPCBenchmarkResources methodsFor:'as yet unclassified'!
    11 
    11 
    12 changesSized: size
    12 changesSized: size
    27 
    27 
    28 javaLangClass
    28 javaLangClass
    29 !
    29 !
    30 
    30 
    31 javaLangMath
    31 javaLangMath
    32 	^ '/*
    32 	^ (FileStream fileNamed: '../java-src/java/lang/Math.java') contents
    33  * @(#)Math.java	1.69 04/06/14
       
    34  *
       
    35  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
       
    36  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
       
    37  */
       
    38 
       
    39 package java.lang;
       
    40 import java.util.Random;
       
    41 
       
    42 
       
    43 /**
       
    44  * The class <code>Math</code> contains methods for performing basic
       
    45  * numeric operations such as the elementary exponential, logarithm,
       
    46  * square root, and trigonometric functions.
       
    47  * 
       
    48  * <p>Unlike some of the numeric methods of class
       
    49  * <code>StrictMath</code>, all implementations of the equivalent
       
    50  * functions of class <code>Math</code> are not defined to return the
       
    51  * bit-for-bit same results.  This relaxation permits
       
    52  * better-performing implementations where strict reproducibility is
       
    53  * not required.
       
    54  * 
       
    55  * <p>By default many of the <code>Math</code> methods simply call
       
    56  * the equivalent method in <code>StrictMath</code> for their
       
    57  * implementation.  Code generators are encouraged to use
       
    58  * platform-specific native libraries or microprocessor instructions,
       
    59  * where available, to provide higher-performance implementations of
       
    60  * <code>Math</code> methods.  Such higher-performance
       
    61  * implementations still must conform to the specification for
       
    62  * <code>Math</code>.
       
    63  * 
       
    64  * <p>The quality of implementation specifications concern two
       
    65  * properties, accuracy of the returned result and monotonicity of the
       
    66  * method.  Accuracy of the floating-point <code>Math</code> methods
       
    67  * is measured in terms of <i>ulps</i>, units in the last place.  For
       
    68  * a given floating-point format, an ulp of a specific real number
       
    69  * value is the distance between the two floating-point values
       
    70  * bracketing that numerical value.  When discussing the accuracy of a
       
    71  * method as a whole rather than at a specific argument, the number of
       
    72  * ulps cited is for the worst-case error at any argument.  If a
       
    73  * method always has an error less than 0.5 ulps, the method always
       
    74  * returns the floating-point number nearest the exact result; such a
       
    75  * method is <i>correctly rounded</i>.  A correctly rounded method is
       
    76  * generally the best a floating-point approximation can be; however,
       
    77  * it is impractical for many floating-point methods to be correctly
       
    78  * rounded.  Instead, for the <code>Math</code> class, a larger error
       
    79  * bound of 1 or 2 ulps is allowed for certain methods.  Informally,
       
    80  * with a 1 ulp error bound, when the exact result is a representable
       
    81  * number, the exact result should be returned as the computed result;
       
    82  * otherwise, either of the two floating-point values which bracket
       
    83  * the exact result may be returned.  For exact results large in
       
    84  * magnitude, one of the endpoints of the bracket may be infinite.
       
    85  * Besides accuracy at individual arguments, maintaining proper
       
    86  * relations between the method at different arguments is also
       
    87  * important.  Therefore, most methods with more than 0.5 ulp errors
       
    88  * are required to be <i>semi-monotonic</i>: whenever the mathematical
       
    89  * function is non-decreasing, so is the floating-point approximation,
       
    90  * likewise, whenever the mathematical function is non-increasing, so
       
    91  * is the floating-point approximation.  Not all approximations that
       
    92  * have 1 ulp accuracy will automatically meet the monotonicity
       
    93  * requirements.
       
    94  * 
       
    95  * @author  unascribed
       
    96  * @author  Joseph D. Darcy
       
    97  * @version 1.69, 06/14/04
       
    98  * @since   JDK1.0
       
    99  */
       
   100 
       
   101 public final class Math {
       
   102 
       
   103     /**
       
   104      * Don''t let anyone instantiate this class.
       
   105      */
       
   106     private Math() {}
       
   107 
       
   108     /**
       
   109      * The <code>double</code> value that is closer than any other to
       
   110      * <i>e</i>, the base of the natural logarithms.
       
   111      */
       
   112     public static final double E = 2.7182818284590452354;
       
   113 
       
   114     /**
       
   115      * The <code>double</code> value that is closer than any other to
       
   116      * <i>pi</i>, the ratio of the circumference of a circle to its
       
   117      * diameter.
       
   118      */
       
   119     public static final double PI = 3.14159265358979323846;
       
   120 
       
   121     /**
       
   122      * Returns the trigonometric sine of an angle.  Special cases:
       
   123      * <ul><li>If the argument is NaN or an infinity, then the 
       
   124      * result is NaN.
       
   125      * <li>If the argument is zero, then the result is a zero with the
       
   126      * same sign as the argument.</ul>
       
   127      * 
       
   128      * <p>The computed result must be within 1 ulp of the exact result.
       
   129      * Results must be semi-monotonic.
       
   130      *
       
   131      * @param   a   an angle, in radians.
       
   132      * @return  the sine of the argument.
       
   133      */
       
   134     public static double sin(double a) {
       
   135 	return StrictMath.sin(a); // default impl. delegates to StrictMath
       
   136     }
       
   137     
       
   138     /**
       
   139      * Returns the trigonometric cosine of an angle. Special cases:
       
   140      * <ul><li>If the argument is NaN or an infinity, then the 
       
   141      * result is NaN.</ul>
       
   142      * 
       
   143      * <p>The computed result must be within 1 ulp of the exact result.
       
   144      * Results must be semi-monotonic.
       
   145      *
       
   146      * @param   a   an angle, in radians.
       
   147      * @return  the cosine of the argument.
       
   148      */
       
   149     public static double cos(double a) {
       
   150 	return StrictMath.cos(a); // default impl. delegates to StrictMath
       
   151     }
       
   152    
       
   153     /**
       
   154      * Returns the trigonometric tangent of an angle.  Special cases:
       
   155      * <ul><li>If the argument is NaN or an infinity, then the result 
       
   156      * is NaN.
       
   157      * <li>If the argument is zero, then the result is a zero with the
       
   158      * same sign as the argument.</ul>
       
   159      * 
       
   160      * <p>The computed result must be within 1 ulp of the exact result.
       
   161      * Results must be semi-monotonic.
       
   162      *
       
   163      * @param   a   an angle, in radians.
       
   164      * @return  the tangent of the argument.
       
   165      */
       
   166     public static double tan(double a) {
       
   167 	return StrictMath.tan(a); // default impl. delegates to StrictMath
       
   168     }
       
   169 
       
   170     /**
       
   171      * Returns the arc sine of an angle, in the range of -<i>pi</i>/2 through
       
   172      * <i>pi</i>/2. Special cases: 
       
   173      * <ul><li>If the argument is NaN or its absolute value is greater 
       
   174      * than 1, then the result is NaN.
       
   175      * <li>If the argument is zero, then the result is a zero with the
       
   176      * same sign as the argument.</ul>
       
   177      * 
       
   178      * <p>The computed result must be within 1 ulp of the exact result.
       
   179      * Results must be semi-monotonic.
       
   180      *
       
   181      * @param   a   the value whose arc sine is to be returned.
       
   182      * @return  the arc sine of the argument.
       
   183      */
       
   184     public static double asin(double a) {
       
   185 	return StrictMath.asin(a); // default impl. delegates to StrictMath
       
   186     }
       
   187 
       
   188     /**
       
   189      * Returns the arc cosine of an angle, in the range of 0.0 through
       
   190      * <i>pi</i>.  Special case:
       
   191      * <ul><li>If the argument is NaN or its absolute value is greater 
       
   192      * than 1, then the result is NaN.</ul>
       
   193      * 
       
   194      * <p>The computed result must be within 1 ulp of the exact result.
       
   195      * Results must be semi-monotonic.
       
   196      *
       
   197      * @param   a   the value whose arc cosine is to be returned.
       
   198      * @return  the arc cosine of the argument.
       
   199      */
       
   200     public static double acos(double a) {
       
   201 	return StrictMath.acos(a); // default impl. delegates to StrictMath
       
   202     }
       
   203 
       
   204     /**
       
   205      * Returns the arc tangent of an angle, in the range of -<i>pi</i>/2
       
   206      * through <i>pi</i>/2.  Special cases: 
       
   207      * <ul><li>If the argument is NaN, then the result is NaN.
       
   208      * <li>If the argument is zero, then the result is a zero with the
       
   209      * same sign as the argument.</ul>
       
   210      * 
       
   211      * <p>The computed result must be within 1 ulp of the exact result.
       
   212      * Results must be semi-monotonic.
       
   213      *
       
   214      * @param   a   the value whose arc tangent is to be returned.
       
   215      * @return  the arc tangent of the argument.
       
   216      */
       
   217     public static double atan(double a) {
       
   218 	return StrictMath.atan(a); // default impl. delegates to StrictMath
       
   219     }
       
   220 
       
   221     /**
       
   222      * Converts an angle measured in degrees to an approximately
       
   223      * equivalent angle measured in radians.  The conversion from
       
   224      * degrees to radians is generally inexact.
       
   225      *
       
   226      * @param   angdeg   an angle, in degrees
       
   227      * @return  the measurement of the angle <code>angdeg</code>
       
   228      *          in radians.
       
   229      * @since   1.2
       
   230      */
       
   231     public static double toRadians(double angdeg) {
       
   232 	return angdeg / 180.0 * PI;
       
   233     }
       
   234 
       
   235     /**
       
   236      * Converts an angle measured in radians to an approximately
       
   237      * equivalent angle measured in degrees.  The conversion from
       
   238      * radians to degrees is generally inexact; users should
       
   239      * <i>not</i> expect <code>cos(toRadians(90.0))</code> to exactly
       
   240      * equal <code>0.0</code>.
       
   241      *
       
   242      * @param   angrad   an angle, in radians
       
   243      * @return  the measurement of the angle <code>angrad</code>
       
   244      *          in degrees.
       
   245      * @since   1.2
       
   246      */
       
   247     public static double toDegrees(double angrad) {
       
   248 	return angrad * 180.0 / PI;
       
   249     }
       
   250 
       
   251     /**
       
   252      * Returns Euler''s number <i>e</i> raised to the power of a
       
   253      * <code>double</code> value.  Special cases:
       
   254      * <ul><li>If the argument is NaN, the result is NaN.
       
   255      * <li>If the argument is positive infinity, then the result is 
       
   256      * positive infinity.
       
   257      * <li>If the argument is negative infinity, then the result is 
       
   258      * positive zero.</ul>
       
   259      * 
       
   260      * <p>The computed result must be within 1 ulp of the exact result.
       
   261      * Results must be semi-monotonic.
       
   262      *
       
   263      * @param   a   the exponent to raise <i>e</i> to.
       
   264      * @return  the value <i>e</i><sup><code>a</code></sup>, 
       
   265      *          where <i>e</i> is the base of the natural logarithms.
       
   266      */
       
   267     public static double exp(double a) {
       
   268 	return StrictMath.exp(a); // default impl. delegates to StrictMath
       
   269     }
       
   270 
       
   271     /**
       
   272      * Returns the natural logarithm (base <i>e</i>) of a <code>double</code>
       
   273      * value.  Special cases:
       
   274      * <ul><li>If the argument is NaN or less than zero, then the result 
       
   275      * is NaN.
       
   276      * <li>If the argument is positive infinity, then the result is 
       
   277      * positive infinity.
       
   278      * <li>If the argument is positive zero or negative zero, then the 
       
   279      * result is negative infinity.</ul>
       
   280      * 
       
   281      * <p>The computed result must be within 1 ulp of the exact result.
       
   282      * Results must be semi-monotonic.
       
   283      *
       
   284      * @param   a   a value
       
   285      * @return  the value ln&nbsp;<code>a</code>, the natural logarithm of
       
   286      *          <code>a</code>.
       
   287      */
       
   288     public static double log(double a) {
       
   289 	return StrictMath.log(a); // default impl. delegates to StrictMath
       
   290     }
       
   291 
       
   292     /**
       
   293      * Returns the base 10 logarithm of a <code>double</code> value.
       
   294      * Special cases:
       
   295      *
       
   296      * <ul><li>If the argument is NaN or less than zero, then the result 
       
   297      * is NaN.
       
   298      * <li>If the argument is positive infinity, then the result is 
       
   299      * positive infinity.
       
   300      * <li>If the argument is positive zero or negative zero, then the 
       
   301      * result is negative infinity.
       
   302      * <li> If the argument is equal to 10<sup><i>n</i></sup> for
       
   303      * integer <i>n</i>, then the result is <i>n</i>.
       
   304      * </ul>
       
   305      * 
       
   306      * <p>The computed result must be within 1 ulp of the exact result.
       
   307      * Results must be semi-monotonic.
       
   308      *
       
   309      * @param   a   a value
       
   310      * @return  the base 10 logarithm of  <code>a</code>.
       
   311      * @since 1.5
       
   312      */
       
   313     public static double log10(double a) {
       
   314 	return StrictMath.log10(a); // default impl. delegates to StrictMath
       
   315     }
       
   316 
       
   317     /**
       
   318      * Returns the correctly rounded positive square root of a 
       
   319      * <code>double</code> value.
       
   320      * Special cases:
       
   321      * <ul><li>If the argument is NaN or less than zero, then the result 
       
   322      * is NaN. 
       
   323      * <li>If the argument is positive infinity, then the result is positive 
       
   324      * infinity. 
       
   325      * <li>If the argument is positive zero or negative zero, then the 
       
   326      * result is the same as the argument.</ul>
       
   327      * Otherwise, the result is the <code>double</code> value closest to 
       
   328      * the true mathematical square root of the argument value.
       
   329      * 
       
   330      * @param   a   a value.
       
   331      * @return  the positive square root of <code>a</code>.
       
   332      *          If the argument is NaN or less than zero, the result is NaN.
       
   333      */
       
   334     public static double sqrt(double a) {
       
   335 	return StrictMath.sqrt(a); // default impl. delegates to StrictMath
       
   336 				   // Note that hardware sqrt instructions
       
   337 				   // frequently can be directly used by JITs
       
   338 				   // and should be much faster than doing
       
   339 				   // Math.sqrt in software.
       
   340     }
       
   341 
       
   342 
       
   343     /**
       
   344      * Returns the cube root of a <code>double</code> value.  For
       
   345      * positive finite <code>x</code>, <code>cbrt(-x) ==
       
   346      * -cbrt(x)</code>; that is, the cube root of a negative value is
       
   347      * the negative of the cube root of that value''s magnitude.
       
   348      * 
       
   349      * Special cases: 
       
   350      *
       
   351      * <ul>
       
   352      * 
       
   353      * <li>If the argument is NaN, then the result is NaN.
       
   354      *
       
   355      * <li>If the argument is infinite, then the result is an infinity
       
   356      * with the same sign as the argument.
       
   357      *
       
   358      * <li>If the argument is zero, then the result is a zero with the
       
   359      * same sign as the argument.
       
   360      * 
       
   361      * </ul>
       
   362      *
       
   363      * <p>The computed result must be within 1 ulp of the exact result.
       
   364      * 
       
   365      * @param   a   a value.
       
   366      * @return  the cube root of <code>a</code>.
       
   367      * @since 1.5
       
   368      */
       
   369     public static double cbrt(double a) {
       
   370 	return StrictMath.cbrt(a);
       
   371     }
       
   372 
       
   373     /**
       
   374      * Computes the remainder operation on two arguments as prescribed 
       
   375      * by the IEEE 754 standard.
       
   376      * The remainder value is mathematically equal to 
       
   377      * <code>f1&nbsp;-&nbsp;f2</code>&nbsp;&times;&nbsp;<i>n</i>,
       
   378      * where <i>n</i> is the mathematical integer closest to the exact 
       
   379      * mathematical value of the quotient <code>f1/f2</code>, and if two 
       
   380      * mathematical integers are equally close to <code>f1/f2</code>, 
       
   381      * then <i>n</i> is the integer that is even. If the remainder is 
       
   382      * zero, its sign is the same as the sign of the first argument. 
       
   383      * Special cases:
       
   384      * <ul><li>If either argument is NaN, or the first argument is infinite, 
       
   385      * or the second argument is positive zero or negative zero, then the 
       
   386      * result is NaN.
       
   387      * <li>If the first argument is finite and the second argument is 
       
   388      * infinite, then the result is the same as the first argument.</ul>
       
   389      *
       
   390      * @param   f1   the dividend.
       
   391      * @param   f2   the divisor.
       
   392      * @return  the remainder when <code>f1</code> is divided by
       
   393      *          <code>f2</code>.
       
   394      */
       
   395     public static double IEEEremainder(double f1, double f2) {
       
   396         return StrictMath.IEEEremainder(f1, f2); // delegate to StrictMath
       
   397     }
       
   398 
       
   399     /**
       
   400      * Returns the smallest (closest to negative infinity)
       
   401      * <code>double</code> value that is greater than or equal to the
       
   402      * argument and is equal to a mathematical integer. Special cases:
       
   403      * <ul><li>If the argument value is already equal to a
       
   404      * mathematical integer, then the result is the same as the
       
   405      * argument.  <li>If the argument is NaN or an infinity or
       
   406      * positive zero or negative zero, then the result is the same as
       
   407      * the argument.  <li>If the argument value is less than zero but
       
   408      * greater than -1.0, then the result is negative zero.</ul> Note
       
   409      * that the value of <code>Math.ceil(x)</code> is exactly the
       
   410      * value of <code>-Math.floor(-x)</code>.
       
   411      *
       
   412      *
       
   413      * @param   a   a value.
       
   414      * @return  the smallest (closest to negative infinity) 
       
   415      *          floating-point value that is greater than or equal to 
       
   416      *          the argument and is equal to a mathematical integer. 
       
   417      */
       
   418     public static double ceil(double a) {
       
   419 	return StrictMath.ceil(a); // default impl. delegates to StrictMath
       
   420     }
       
   421 
       
   422     /**
       
   423      * Returns the largest (closest to positive infinity)
       
   424      * <code>double</code> value that is less than or equal to the
       
   425      * argument and is equal to a mathematical integer. Special cases:
       
   426      * <ul><li>If the argument value is already equal to a
       
   427      * mathematical integer, then the result is the same as the
       
   428      * argument.  <li>If the argument is NaN or an infinity or
       
   429      * positive zero or negative zero, then the result is the same as
       
   430      * the argument.</ul>
       
   431      *
       
   432      * @param   a   a value.
       
   433      * @return  the largest (closest to positive infinity) 
       
   434      *          floating-point value that less than or equal to the argument
       
   435      *          and is equal to a mathematical integer. 
       
   436      */
       
   437     public static double floor(double a) {
       
   438 	return StrictMath.floor(a); // default impl. delegates to StrictMath
       
   439     }
       
   440 
       
   441     /**
       
   442      * Returns the <code>double</code> value that is closest in value
       
   443      * to the argument and is equal to a mathematical integer. If two
       
   444      * <code>double</code> values that are mathematical integers are
       
   445      * equally close, the result is the integer value that is
       
   446      * even. Special cases:
       
   447      * <ul><li>If the argument value is already equal to a mathematical 
       
   448      * integer, then the result is the same as the argument. 
       
   449      * <li>If the argument is NaN or an infinity or positive zero or negative 
       
   450      * zero, then the result is the same as the argument.</ul>
       
   451      *
       
   452      * @param   a   a <code>double</code> value.
       
   453      * @return  the closest floating-point value to <code>a</code> that is
       
   454      *          equal to a mathematical integer.
       
   455      */
       
   456     public static double rint(double a) {
       
   457 	return StrictMath.rint(a); // default impl. delegates to StrictMath
       
   458     }
       
   459 
       
   460     /**
       
   461      * Converts rectangular coordinates (<code>x</code>,&nbsp;<code>y</code>)
       
   462      * to polar (r,&nbsp;<i>theta</i>).
       
   463      * This method computes the phase <i>theta</i> by computing an arc tangent
       
   464      * of <code>y/x</code> in the range of -<i>pi</i> to <i>pi</i>. Special 
       
   465      * cases:
       
   466      * <ul><li>If either argument is NaN, then the result is NaN. 
       
   467      * <li>If the first argument is positive zero and the second argument 
       
   468      * is positive, or the first argument is positive and finite and the 
       
   469      * second argument is positive infinity, then the result is positive 
       
   470      * zero. 
       
   471      * <li>If the first argument is negative zero and the second argument 
       
   472      * is positive, or the first argument is negative and finite and the 
       
   473      * second argument is positive infinity, then the result is negative zero. 
       
   474      * <li>If the first argument is positive zero and the second argument 
       
   475      * is negative, or the first argument is positive and finite and the 
       
   476      * second argument is negative infinity, then the result is the 
       
   477      * <code>double</code> value closest to <i>pi</i>. 
       
   478      * <li>If the first argument is negative zero and the second argument 
       
   479      * is negative, or the first argument is negative and finite and the 
       
   480      * second argument is negative infinity, then the result is the 
       
   481      * <code>double</code> value closest to -<i>pi</i>. 
       
   482      * <li>If the first argument is positive and the second argument is 
       
   483      * positive zero or negative zero, or the first argument is positive 
       
   484      * infinity and the second argument is finite, then the result is the 
       
   485      * <code>double</code> value closest to <i>pi</i>/2. 
       
   486      * <li>If the first argument is negative and the second argument is 
       
   487      * positive zero or negative zero, or the first argument is negative 
       
   488      * infinity and the second argument is finite, then the result is the 
       
   489      * <code>double</code> value closest to -<i>pi</i>/2. 
       
   490      * <li>If both arguments are positive infinity, then the result is the 
       
   491      * <code>double</code> value closest to <i>pi</i>/4. 
       
   492      * <li>If the first argument is positive infinity and the second argument 
       
   493      * is negative infinity, then the result is the <code>double</code> 
       
   494      * value closest to 3*<i>pi</i>/4. 
       
   495      * <li>If the first argument is negative infinity and the second argument 
       
   496      * is positive infinity, then the result is the <code>double</code> value 
       
   497      * closest to -<i>pi</i>/4. 
       
   498      * <li>If both arguments are negative infinity, then the result is the 
       
   499      * <code>double</code> value closest to -3*<i>pi</i>/4.</ul>
       
   500      * 
       
   501      * <p>The computed result must be within 2 ulps of the exact result.
       
   502      * Results must be semi-monotonic.
       
   503      *
       
   504      * @param   y   the ordinate coordinate
       
   505      * @param   x   the abscissa coordinate
       
   506      * @return  the <i>theta</i> component of the point
       
   507      *          (<i>r</i>,&nbsp;<i>theta</i>)
       
   508      *          in polar coordinates that corresponds to the point
       
   509      *          (<i>x</i>,&nbsp;<i>y</i>) in Cartesian coordinates.
       
   510      */
       
   511     public static double atan2(double y, double x) {
       
   512 	return StrictMath.atan2(y, x); // default impl. delegates to StrictMath
       
   513     }
       
   514 
       
   515     /**
       
   516      * Returns the value of the first argument raised to the power of the
       
   517      * second argument. Special cases:
       
   518      *
       
   519      * <ul><li>If the second argument is positive or negative zero, then the 
       
   520      * result is 1.0. 
       
   521      * <li>If the second argument is 1.0, then the result is the same as the 
       
   522      * first argument.
       
   523      * <li>If the second argument is NaN, then the result is NaN. 
       
   524      * <li>If the first argument is NaN and the second argument is nonzero, 
       
   525      * then the result is NaN. 
       
   526      *
       
   527      * <li>If
       
   528      * <ul>
       
   529      * <li>the absolute value of the first argument is greater than 1
       
   530      * and the second argument is positive infinity, or
       
   531      * <li>the absolute value of the first argument is less than 1 and
       
   532      * the second argument is negative infinity,
       
   533      * </ul>
       
   534      * then the result is positive infinity. 
       
   535      *
       
   536      * <li>If 
       
   537      * <ul>
       
   538      * <li>the absolute value of the first argument is greater than 1 and 
       
   539      * the second argument is negative infinity, or 
       
   540      * <li>the absolute value of the 
       
   541      * first argument is less than 1 and the second argument is positive 
       
   542      * infinity,
       
   543      * </ul>
       
   544      * then the result is positive zero. 
       
   545      *
       
   546      * <li>If the absolute value of the first argument equals 1 and the 
       
   547      * second argument is infinite, then the result is NaN. 
       
   548      *
       
   549      * <li>If 
       
   550      * <ul>
       
   551      * <li>the first argument is positive zero and the second argument
       
   552      * is greater than zero, or
       
   553      * <li>the first argument is positive infinity and the second
       
   554      * argument is less than zero,
       
   555      * </ul>
       
   556      * then the result is positive zero. 
       
   557      *
       
   558      * <li>If 
       
   559      * <ul>
       
   560      * <li>the first argument is positive zero and the second argument
       
   561      * is less than zero, or
       
   562      * <li>the first argument is positive infinity and the second
       
   563      * argument is greater than zero,
       
   564      * </ul>
       
   565      * then the result is positive infinity.
       
   566      *
       
   567      * <li>If 
       
   568      * <ul>
       
   569      * <li>the first argument is negative zero and the second argument
       
   570      * is greater than zero but not a finite odd integer, or
       
   571      * <li>the first argument is negative infinity and the second
       
   572      * argument is less than zero but not a finite odd integer,
       
   573      * </ul>
       
   574      * then the result is positive zero. 
       
   575      *
       
   576      * <li>If 
       
   577      * <ul>
       
   578      * <li>the first argument is negative zero and the second argument
       
   579      * is a positive finite odd integer, or
       
   580      * <li>the first argument is negative infinity and the second
       
   581      * argument is a negative finite odd integer,
       
   582      * </ul>
       
   583      * then the result is negative zero. 
       
   584      *
       
   585      * <li>If
       
   586      * <ul>
       
   587      * <li>the first argument is negative zero and the second argument
       
   588      * is less than zero but not a finite odd integer, or
       
   589      * <li>the first argument is negative infinity and the second
       
   590      * argument is greater than zero but not a finite odd integer,
       
   591      * </ul>
       
   592      * then the result is positive infinity. 
       
   593      *
       
   594      * <li>If 
       
   595      * <ul>
       
   596      * <li>the first argument is negative zero and the second argument
       
   597      * is a negative finite odd integer, or
       
   598      * <li>the first argument is negative infinity and the second
       
   599      * argument is a positive finite odd integer,
       
   600      * </ul>
       
   601      * then the result is negative infinity. 
       
   602      *
       
   603      * <li>If the first argument is finite and less than zero
       
   604      * <ul>
       
   605      * <li> if the second argument is a finite even integer, the
       
   606      * result is equal to the result of raising the absolute value of
       
   607      * the first argument to the power of the second argument
       
   608      *
       
   609      * <li>if the second argument is a finite odd integer, the result
       
   610      * is equal to the negative of the result of raising the absolute
       
   611      * value of the first argument to the power of the second
       
   612      * argument
       
   613      *
       
   614      * <li>if the second argument is finite and not an integer, then
       
   615      * the result is NaN.
       
   616      * </ul>
       
   617      *
       
   618      * <li>If both arguments are integers, then the result is exactly equal 
       
   619      * to the mathematical result of raising the first argument to the power 
       
   620      * of the second argument if that result can in fact be represented 
       
   621      * exactly as a <code>double</code> value.</ul>
       
   622      * 
       
   623      * <p>(In the foregoing descriptions, a floating-point value is
       
   624      * considered to be an integer if and only if it is finite and a
       
   625      * fixed point of the method {@link #ceil <tt>ceil</tt>} or,
       
   626      * equivalently, a fixed point of the method {@link #floor
       
   627      * <tt>floor</tt>}. A value is a fixed point of a one-argument
       
   628      * method if and only if the result of applying the method to the
       
   629      * value is equal to the value.)
       
   630      *
       
   631      * <p>The computed result must be within 1 ulp of the exact result.
       
   632      * Results must be semi-monotonic.
       
   633      *
       
   634      * @param   a   the base.
       
   635      * @param   b   the exponent.
       
   636      * @return  the value <code>a<sup>b</sup></code>.
       
   637      */
       
   638     public static double pow(double a, double b) {
       
   639 	return StrictMath.pow(a, b); // default impl. delegates to StrictMath
       
   640     }
       
   641 
       
   642     /**
       
   643      * Returns the closest <code>int</code> to the argument. The 
       
   644      * result is rounded to an integer by adding 1/2, taking the 
       
   645      * floor of the result, and casting the result to type <code>int</code>. 
       
   646      * In other words, the result is equal to the value of the expression:
       
   647      * <p><pre>(int)Math.floor(a + 0.5f)</pre>
       
   648      * <p>
       
   649      * Special cases:
       
   650      * <ul><li>If the argument is NaN, the result is 0.
       
   651      * <li>If the argument is negative infinity or any value less than or 
       
   652      * equal to the value of <code>Integer.MIN_VALUE</code>, the result is 
       
   653      * equal to the value of <code>Integer.MIN_VALUE</code>. 
       
   654      * <li>If the argument is positive infinity or any value greater than or 
       
   655      * equal to the value of <code>Integer.MAX_VALUE</code>, the result is 
       
   656      * equal to the value of <code>Integer.MAX_VALUE</code>.</ul> 
       
   657      *
       
   658      * @param   a   a floating-point value to be rounded to an integer.
       
   659      * @return  the value of the argument rounded to the nearest
       
   660      *          <code>int</code> value.
       
   661      * @see     java.lang.Integer#MAX_VALUE
       
   662      * @see     java.lang.Integer#MIN_VALUE
       
   663      */
       
   664     public static int round(float a) {
       
   665 	return (int)floor(a + 0.5f);
       
   666     }
       
   667 
       
   668     /**
       
   669      * Returns the closest <code>long</code> to the argument. The result 
       
   670      * is rounded to an integer by adding 1/2, taking the floor of the 
       
   671      * result, and casting the result to type <code>long</code>. In other 
       
   672      * words, the result is equal to the value of the expression:
       
   673      * <p><pre>(long)Math.floor(a + 0.5d)</pre>
       
   674      * <p>
       
   675      * Special cases:
       
   676      * <ul><li>If the argument is NaN, the result is 0.
       
   677      * <li>If the argument is negative infinity or any value less than or 
       
   678      * equal to the value of <code>Long.MIN_VALUE</code>, the result is 
       
   679      * equal to the value of <code>Long.MIN_VALUE</code>. 
       
   680      * <li>If the argument is positive infinity or any value greater than or 
       
   681      * equal to the value of <code>Long.MAX_VALUE</code>, the result is 
       
   682      * equal to the value of <code>Long.MAX_VALUE</code>.</ul> 
       
   683      *
       
   684      * @param   a   a floating-point value to be rounded to a 
       
   685      *		<code>long</code>.
       
   686      * @return  the value of the argument rounded to the nearest
       
   687      *          <code>long</code> value.
       
   688      * @see     java.lang.Long#MAX_VALUE
       
   689      * @see     java.lang.Long#MIN_VALUE
       
   690      */
       
   691     public static long round(double a) {
       
   692 	return (long)floor(a + 0.5d);
       
   693     }
       
   694 
       
   695     private static Random randomNumberGenerator;
       
   696 
       
   697     private static synchronized void initRNG() {
       
   698         if (randomNumberGenerator == null) 
       
   699             randomNumberGenerator = new Random();
       
   700     }
       
   701 
       
   702     /**
       
   703      * Returns a <code>double</code> value with a positive sign, greater 
       
   704      * than or equal to <code>0.0</code> and less than <code>1.0</code>. 
       
   705      * Returned values are chosen pseudorandomly with (approximately) 
       
   706      * uniform distribution from that range. 
       
   707      * 
       
   708      * <p>When this method is first called, it creates a single new
       
   709      * pseudorandom-number generator, exactly as if by the expression
       
   710      * <blockquote><pre>new java.util.Random</pre></blockquote> This
       
   711      * new pseudorandom-number generator is used thereafter for all
       
   712      * calls to this method and is used nowhere else.
       
   713      * 
       
   714      * <p>This method is properly synchronized to allow correct use by
       
   715      * more than one thread. However, if many threads need to generate
       
   716      * pseudorandom numbers at a great rate, it may reduce contention
       
   717      * for each thread to have its own pseudorandom-number generator.
       
   718      *  
       
   719      * @return  a pseudorandom <code>double</code> greater than or equal 
       
   720      * to <code>0.0</code> and less than <code>1.0</code>.
       
   721      * @see     java.util.Random#nextDouble()
       
   722      */
       
   723     public static double random() {
       
   724         if (randomNumberGenerator == null) initRNG();
       
   725         return randomNumberGenerator.nextDouble();
       
   726     }
       
   727 
       
   728     /**
       
   729      * Returns the absolute value of an <code>int</code> value.
       
   730      * If the argument is not negative, the argument is returned.
       
   731      * If the argument is negative, the negation of the argument is returned. 
       
   732      * 
       
   733      * <p>Note that if the argument is equal to the value of
       
   734      * <code>Integer.MIN_VALUE</code>, the most negative representable
       
   735      * <code>int</code> value, the result is that same value, which is
       
   736      * negative.
       
   737      *
       
   738      * @param   a   the argument whose absolute value is to be determined
       
   739      * @return  the absolute value of the argument.
       
   740      * @see     java.lang.Integer#MIN_VALUE
       
   741      */
       
   742     public static int abs(int a) {
       
   743 	return (a < 0) ? -a : a;
       
   744     }
       
   745 
       
   746     /**
       
   747      * Returns the absolute value of a <code>long</code> value.
       
   748      * If the argument is not negative, the argument is returned.
       
   749      * If the argument is negative, the negation of the argument is returned. 
       
   750      * 
       
   751      * <p>Note that if the argument is equal to the value of
       
   752      * <code>Long.MIN_VALUE</code>, the most negative representable
       
   753      * <code>long</code> value, the result is that same value, which
       
   754      * is negative.
       
   755      *
       
   756      * @param   a   the argument whose absolute value is to be determined
       
   757      * @return  the absolute value of the argument.
       
   758      * @see     java.lang.Long#MIN_VALUE
       
   759      */
       
   760     public static long abs(long a) {
       
   761 	return (a < 0) ? -a : a;
       
   762     }
       
   763 
       
   764     /**
       
   765      * Returns the absolute value of a <code>float</code> value.
       
   766      * If the argument is not negative, the argument is returned.
       
   767      * If the argument is negative, the negation of the argument is returned.
       
   768      * Special cases:
       
   769      * <ul><li>If the argument is positive zero or negative zero, the 
       
   770      * result is positive zero. 
       
   771      * <li>If the argument is infinite, the result is positive infinity. 
       
   772      * <li>If the argument is NaN, the result is NaN.</ul>
       
   773      * In other words, the result is the same as the value of the expression: 
       
   774      * <p><pre>Float.intBitsToFloat(0x7fffffff & Float.floatToIntBits(a))</pre>
       
   775      *
       
   776      * @param   a   the argument whose absolute value is to be determined
       
   777      * @return  the absolute value of the argument.
       
   778      */
       
   779     public static float abs(float a) {
       
   780         return (a <= 0.0F) ? 0.0F - a : a;
       
   781     }
       
   782   
       
   783     /**
       
   784      * Returns the absolute value of a <code>double</code> value.
       
   785      * If the argument is not negative, the argument is returned.
       
   786      * If the argument is negative, the negation of the argument is returned.
       
   787      * Special cases:
       
   788      * <ul><li>If the argument is positive zero or negative zero, the result 
       
   789      * is positive zero. 
       
   790      * <li>If the argument is infinite, the result is positive infinity. 
       
   791      * <li>If the argument is NaN, the result is NaN.</ul>
       
   792      * In other words, the result is the same as the value of the expression: 
       
   793      * <p><code>Double.longBitsToDouble((Double.doubleToLongBits(a)&lt;&lt;1)&gt;&gt;&gt;1)</code> 
       
   794      *
       
   795      * @param   a   the argument whose absolute value is to be determined
       
   796      * @return  the absolute value of the argument.
       
   797      */
       
   798     public static double abs(double a) {
       
   799         return (a <= 0.0D) ? 0.0D - a : a;
       
   800     }
       
   801 
       
   802     /**
       
   803      * Returns the greater of two <code>int</code> values. That is, the 
       
   804      * result is the argument closer to the value of 
       
   805      * <code>Integer.MAX_VALUE</code>. If the arguments have the same value, 
       
   806      * the result is that same value.
       
   807      *
       
   808      * @param   a   an argument.
       
   809      * @param   b   another argument.
       
   810      * @return  the larger of <code>a</code> and <code>b</code>.
       
   811      * @see     java.lang.Long#MAX_VALUE
       
   812      */
       
   813     public static int max(int a, int b) {
       
   814 	return (a >= b) ? a : b;
       
   815     }
       
   816 
       
   817     /**
       
   818      * Returns the greater of two <code>long</code> values. That is, the 
       
   819      * result is the argument closer to the value of 
       
   820      * <code>Long.MAX_VALUE</code>. If the arguments have the same value, 
       
   821      * the result is that same value. 
       
   822      *
       
   823      * @param   a   an argument.
       
   824      * @param   b   another argument.
       
   825      * @return  the larger of <code>a</code> and <code>b</code>.
       
   826      * @see     java.lang.Long#MAX_VALUE
       
   827      */
       
   828     public static long max(long a, long b) {
       
   829 	return (a >= b) ? a : b;
       
   830     }
       
   831 
       
   832     private static long negativeZeroFloatBits = Float.floatToIntBits(-0.0f);
       
   833     private static long negativeZeroDoubleBits = Double.doubleToLongBits(-0.0d);
       
   834 
       
   835     /**
       
   836      * Returns the greater of two <code>float</code> values.  That is,
       
   837      * the result is the argument closer to positive infinity. If the
       
   838      * arguments have the same value, the result is that same
       
   839      * value. If either value is NaN, then the result is NaN.  Unlike
       
   840      * the numerical comparison operators, this method considers
       
   841      * negative zero to be strictly smaller than positive zero. If one
       
   842      * argument is positive zero and the other negative zero, the
       
   843      * result is positive zero.
       
   844      *
       
   845      * @param   a   an argument.
       
   846      * @param   b   another argument.
       
   847      * @return  the larger of <code>a</code> and <code>b</code>.
       
   848      */
       
   849     public static float max(float a, float b) {
       
   850         if (a !!= a) return a;	// a is NaN
       
   851 	if ((a == 0.0f) && (b == 0.0f)
       
   852 	    && (Float.floatToIntBits(a) == negativeZeroFloatBits)) {
       
   853 	    return b;
       
   854 	}
       
   855 	return (a >= b) ? a : b;
       
   856     }
       
   857 
       
   858     /**
       
   859      * Returns the greater of two <code>double</code> values.  That
       
   860      * is, the result is the argument closer to positive infinity. If
       
   861      * the arguments have the same value, the result is that same
       
   862      * value. If either value is NaN, then the result is NaN.  Unlike
       
   863      * the numerical comparison operators, this method considers
       
   864      * negative zero to be strictly smaller than positive zero. If one
       
   865      * argument is positive zero and the other negative zero, the
       
   866      * result is positive zero.
       
   867      *
       
   868      * @param   a   an argument.
       
   869      * @param   b   another argument.
       
   870      * @return  the larger of <code>a</code> and <code>b</code>.
       
   871      */
       
   872     public static double max(double a, double b) {
       
   873         if (a !!= a) return a;	// a is NaN
       
   874 	if ((a == 0.0d) && (b == 0.0d)
       
   875 	    && (Double.doubleToLongBits(a) == negativeZeroDoubleBits)) {
       
   876 	    return b;
       
   877 	}
       
   878 	return (a >= b) ? a : b;
       
   879     }
       
   880 
       
   881     /**
       
   882      * Returns the smaller of two <code>int</code> values. That is,
       
   883      * the result the argument closer to the value of
       
   884      * <code>Integer.MIN_VALUE</code>.  If the arguments have the same
       
   885      * value, the result is that same value.
       
   886      *
       
   887      * @param   a   an argument.
       
   888      * @param   b   another argument.
       
   889      * @return  the smaller of <code>a</code> and <code>b</code>.
       
   890      * @see     java.lang.Long#MIN_VALUE
       
   891      */
       
   892     public static int min(int a, int b) {
       
   893 	return (a <= b) ? a : b;
       
   894     }
       
   895 
       
   896     /**
       
   897      * Returns the smaller of two <code>long</code> values. That is,
       
   898      * the result is the argument closer to the value of
       
   899      * <code>Long.MIN_VALUE</code>. If the arguments have the same
       
   900      * value, the result is that same value.
       
   901      *
       
   902      * @param   a   an argument.
       
   903      * @param   b   another argument.
       
   904      * @return  the smaller of <code>a</code> and <code>b</code>.
       
   905      * @see     java.lang.Long#MIN_VALUE
       
   906      */
       
   907     public static long min(long a, long b) {
       
   908 	return (a <= b) ? a : b;
       
   909     }
       
   910 
       
   911     /**
       
   912      * Returns the smaller of two <code>float</code> values.  That is,
       
   913      * the result is the value closer to negative infinity. If the
       
   914      * arguments have the same value, the result is that same
       
   915      * value. If either value is NaN, then the result is NaN.  Unlike
       
   916      * the numerical comparison operators, this method considers
       
   917      * negative zero to be strictly smaller than positive zero.  If
       
   918      * one argument is positive zero and the other is negative zero,
       
   919      * the result is negative zero.
       
   920      *
       
   921      * @param   a   an argument.
       
   922      * @param   b   another argument.
       
   923      * @return  the smaller of <code>a</code> and <code>b.</code>
       
   924      */
       
   925     public static float min(float a, float b) {
       
   926         if (a !!= a) return a;	// a is NaN
       
   927 	if ((a == 0.0f) && (b == 0.0f)
       
   928 	    && (Float.floatToIntBits(b) == negativeZeroFloatBits)) {
       
   929 	    return b;
       
   930 	}
       
   931 	return (a <= b) ? a : b;
       
   932     }
       
   933 
       
   934     /**
       
   935      * Returns the smaller of two <code>double</code> values.  That
       
   936      * is, the result is the value closer to negative infinity. If the
       
   937      * arguments have the same value, the result is that same
       
   938      * value. If either value is NaN, then the result is NaN.  Unlike
       
   939      * the numerical comparison operators, this method considers
       
   940      * negative zero to be strictly smaller than positive zero. If one
       
   941      * argument is positive zero and the other is negative zero, the
       
   942      * result is negative zero.
       
   943      *
       
   944      * @param   a   an argument.
       
   945      * @param   b   another argument.
       
   946      * @return  the smaller of <code>a</code> and <code>b</code>.
       
   947      */
       
   948     public static double min(double a, double b) {
       
   949         if (a !!= a) return a;	// a is NaN
       
   950 	if ((a == 0.0d) && (b == 0.0d)
       
   951 	    && (Double.doubleToLongBits(b) == negativeZeroDoubleBits)) {
       
   952 	    return b;
       
   953 	}
       
   954 	return (a <= b) ? a : b;
       
   955     }
       
   956 
       
   957     /**
       
   958      * Returns the size of an ulp of the argument.  An ulp of a
       
   959      * <code>double</code> value is the positive distance between this
       
   960      * floating-point value and the <code>double</code> value next
       
   961      * larger in magnitude.  Note that for non-NaN <i>x</i>,
       
   962      * <code>ulp(-<i>x</i>) == ulp(<i>x</i>)</code>.
       
   963      * 
       
   964      * <p>Special Cases:
       
   965      * <ul>
       
   966      * <li> If the argument is NaN, then the result is NaN.
       
   967      * <li> If the argument is positive or negative infinity, then the
       
   968      * result is positive infinity.
       
   969      * <li> If the argument is positive or negative zero, then the result is
       
   970      * <code>Double.MIN_VALUE</code>.
       
   971      * <li> If the argument is &plusmn;<code>Double.MAX_VALUE</code>, then
       
   972      * the result is equal to 2<sup>971</sup>.
       
   973      * </ul>
       
   974      *
       
   975      * @param d the floating-point value whose ulp is to be returned
       
   976      * @return the size of an ulp of the argument
       
   977      * @author Joseph D. Darcy
       
   978      * @since 1.5
       
   979      */
       
   980     public static double ulp(double d) {
       
   981 	return sun.misc.FpUtils.ulp(d);
       
   982     }
       
   983 
       
   984     /**
       
   985      * Returns the size of an ulp of the argument.  An ulp of a
       
   986      * <code>float</code> value is the positive distance between this
       
   987      * floating-point value and the <code>float</code> value next
       
   988      * larger in magnitude.  Note that for non-NaN <i>x</i>,
       
   989      * <code>ulp(-<i>x</i>) == ulp(<i>x</i>)</code>.
       
   990      * 
       
   991      * <p>Special Cases:
       
   992      * <ul>
       
   993      * <li> If the argument is NaN, then the result is NaN.
       
   994      * <li> If the argument is positive or negative infinity, then the
       
   995      * result is positive infinity.
       
   996      * <li> If the argument is positive or negative zero, then the result is
       
   997      * <code>Float.MIN_VALUE</code>.
       
   998      * <li> If the argument is &plusmn;<code>Float.MAX_VALUE</code>, then
       
   999      * the result is equal to 2<sup>104</sup>.
       
  1000      * </ul>
       
  1001      *
       
  1002      * @param f the floating-point value whose ulp is to be returned
       
  1003      * @return the size of an ulp of the argument
       
  1004      * @author Joseph D. Darcy
       
  1005      * @since 1.5
       
  1006      */
       
  1007     public static float ulp(float f) {
       
  1008 	return sun.misc.FpUtils.ulp(f);
       
  1009     }
       
  1010 
       
  1011     /**
       
  1012      * Returns the signum function of the argument; zero if the argument
       
  1013      * is zero, 1.0 if the argument is greater than zero, -1.0 if the
       
  1014      * argument is less than zero.
       
  1015      *
       
  1016      * <p>Special Cases:
       
  1017      * <ul>
       
  1018      * <li> If the argument is NaN, then the result is NaN.
       
  1019      * <li> If the argument is positive zero or negative zero, then the
       
  1020      *      result is the same as the argument.
       
  1021      * </ul>
       
  1022      *
       
  1023      * @param d the floating-point value whose signum is to be returned
       
  1024      * @return the signum function of the argument
       
  1025      * @author Joseph D. Darcy
       
  1026      * @since 1.5
       
  1027      */
       
  1028     public static double signum(double d) {
       
  1029 	return sun.misc.FpUtils.signum(d);
       
  1030     }
       
  1031 
       
  1032     /**
       
  1033      * Returns the signum function of the argument; zero if the argument
       
  1034      * is zero, 1.0f if the argument is greater than zero, -1.0f if the
       
  1035      * argument is less than zero.
       
  1036      *
       
  1037      * <p>Special Cases:
       
  1038      * <ul>
       
  1039      * <li> If the argument is NaN, then the result is NaN.
       
  1040      * <li> If the argument is positive zero or negative zero, then the
       
  1041      *      result is the same as the argument.
       
  1042      * </ul>
       
  1043      *
       
  1044      * @param f the floating-point value whose signum is to be returned
       
  1045      * @return the signum function of the argument
       
  1046      * @author Joseph D. Darcy
       
  1047      * @since 1.5
       
  1048      */
       
  1049     public static float signum(float f) {
       
  1050 	return sun.misc.FpUtils.signum(f);
       
  1051     }
       
  1052 
       
  1053     /**
       
  1054      * Returns the hyperbolic sine of a <code>double</code> value.
       
  1055      * The hyperbolic sine of <i>x</i> is defined to be
       
  1056      * (<i>e<sup>x</sup>&nbsp;-&nbsp;e<sup>-x</sup></i>)/2
       
  1057      * where <i>e</i> is {@linkplain Math#E Euler''s number}.
       
  1058      *
       
  1059      * <p>Special cases:
       
  1060      * <ul>
       
  1061      *
       
  1062      * <li>If the argument is NaN, then the result is NaN.
       
  1063      *
       
  1064      * <li>If the argument is infinite, then the result is an infinity
       
  1065      * with the same sign as the argument.
       
  1066      *
       
  1067      * <li>If the argument is zero, then the result is a zero with the
       
  1068      * same sign as the argument.
       
  1069      *
       
  1070      * </ul>
       
  1071      *
       
  1072      * <p>The computed result must be within 2.5 ulps of the exact result.
       
  1073      *
       
  1074      * @param   x The number whose hyperbolic sine is to be returned.
       
  1075      * @return  The hyperbolic sine of <code>x</code>.
       
  1076      * @since 1.5
       
  1077      */
       
  1078     public static double sinh(double x) {
       
  1079 	return StrictMath.sinh(x);
       
  1080     }
       
  1081 
       
  1082     /**
       
  1083      * Returns the hyperbolic cosine of a <code>double</code> value.
       
  1084      * The hyperbolic cosine of <i>x</i> is defined to be
       
  1085      * (<i>e<sup>x</sup>&nbsp;+&nbsp;e<sup>-x</sup></i>)/2
       
  1086      * where <i>e</i> is {@linkplain Math#E Euler''s number}.
       
  1087      *
       
  1088      * <p>Special cases:
       
  1089      * <ul>
       
  1090      *
       
  1091      * <li>If the argument is NaN, then the result is NaN.
       
  1092      *
       
  1093      * <li>If the argument is infinite, then the result is positive
       
  1094      * infinity.
       
  1095      *
       
  1096      * <li>If the argument is zero, then the result is <code>1.0</code>.
       
  1097      *
       
  1098      * </ul>
       
  1099      *
       
  1100      * <p>The computed result must be within 2.5 ulps of the exact result.
       
  1101      *
       
  1102      * @param   x The number whose hyperbolic cosine is to be returned.
       
  1103      * @return  The hyperbolic cosine of <code>x</code>.
       
  1104      * @since 1.5
       
  1105      */
       
  1106     public static double cosh(double x) {
       
  1107 	return StrictMath.cosh(x);
       
  1108     }
       
  1109 
       
  1110     /**
       
  1111      * Returns the hyperbolic tangent of a <code>double</code> value.
       
  1112      * The hyperbolic tangent of <i>x</i> is defined to be
       
  1113      * (<i>e<sup>x</sup>&nbsp;-&nbsp;e<sup>-x</sup></i>)/(<i>e<sup>x</sup>&nbsp;+&nbsp;e<sup>-x</sup></i>),
       
  1114      * in other words, {@linkplain Math#sinh
       
  1115      * sinh(<i>x</i>)}/{@linkplain Math#cosh cosh(<i>x</i>)}.  Note
       
  1116      * that the absolute value of the exact tanh is always less than
       
  1117      * 1.
       
  1118      *
       
  1119      * <p>Special cases:
       
  1120      * <ul>
       
  1121      *
       
  1122      * <li>If the argument is NaN, then the result is NaN.
       
  1123      *
       
  1124      * <li>If the argument is zero, then the result is a zero with the
       
  1125      * same sign as the argument.
       
  1126      *
       
  1127      * <li>If the argument is positive infinity, then the result is
       
  1128      * <code>+1.0</code>.
       
  1129      *
       
  1130      * <li>If the argument is negative infinity, then the result is
       
  1131      * <code>-1.0</code>.
       
  1132      *  
       
  1133      * </ul>
       
  1134      *
       
  1135      * <p>The computed result must be within 2.5 ulps of the exact result.
       
  1136      * The result of <code>tanh</code> for any finite input must have
       
  1137      * an absolute value less than or equal to 1.  Note that once the
       
  1138      * exact result of tanh is within 1/2 of an ulp of the limit value
       
  1139      * of &plusmn;1, correctly signed &plusmn;<code>1.0</code> should
       
  1140      * be returned.
       
  1141      *
       
  1142      * @param   x The number whose hyperbolic tangent is to be returned.
       
  1143      * @return  The hyperbolic tangent of <code>x</code>.
       
  1144      * @since 1.5
       
  1145      */
       
  1146     public static double tanh(double x) {
       
  1147 	return StrictMath.tanh(x);
       
  1148     }
       
  1149 
       
  1150     /**
       
  1151      * Returns sqrt(<i>x</i><sup>2</sup>&nbsp;+<i>y</i><sup>2</sup>)
       
  1152      * without intermediate overflow or underflow.
       
  1153      *
       
  1154      * <p>Special cases:
       
  1155      * <ul>
       
  1156      *
       
  1157      * <li> If either argument is infinite, then the result
       
  1158      * is positive infinity.
       
  1159      *
       
  1160      * <li> If either argument is NaN and neither argument is infinite,
       
  1161      * then the result is NaN.
       
  1162      *
       
  1163      * </ul>
       
  1164      *
       
  1165      * <p>The computed result must be within 1 ulp of the exact
       
  1166      * result.  If one parameter is held constant, the results must be
       
  1167      * semi-monotonic in the other parameter.
       
  1168      *
       
  1169      * @param x a value
       
  1170      * @param y a value
       
  1171      * @return sqrt(<i>x</i><sup>2</sup>&nbsp;+<i>y</i><sup>2</sup>)
       
  1172      * without intermediate overflow or underflow
       
  1173      * @since 1.5
       
  1174      */
       
  1175     public static double hypot(double x, double y) {
       
  1176 	return StrictMath.hypot(x, y);
       
  1177     }
       
  1178 
       
  1179     /**
       
  1180      * Returns <i>e</i><sup>x</sup>&nbsp;-1.  Note that for values of
       
  1181      * <i>x</i> near 0, the exact sum of
       
  1182      * <code>expm1(x)</code>&nbsp;+&nbsp;1 is much closer to the true
       
  1183      * result of <i>e</i><sup>x</sup> than <code>exp(x)</code>.
       
  1184      *
       
  1185      * <p>Special cases:
       
  1186      * <ul>
       
  1187      * <li>If the argument is NaN, the result is NaN.
       
  1188      *
       
  1189      * <li>If the argument is positive infinity, then the result is
       
  1190      * positive infinity.
       
  1191      *
       
  1192      * <li>If the argument is negative infinity, then the result is
       
  1193      * -1.0.
       
  1194      *
       
  1195      * <li>If the argument is zero, then the result is a zero with the
       
  1196      * same sign as the argument.
       
  1197      *
       
  1198      * </ul>
       
  1199      *
       
  1200      * <p>The computed result must be within 1 ulp of the exact result.
       
  1201      * Results must be semi-monotonic.  The result of
       
  1202      * <code>expm1</code> for any finite input must be greater than or
       
  1203      * equal to <code>-1.0</code>.  Note that once the exact result of
       
  1204      * <i>e</i><sup><code>x</code></sup>&nbsp;-&nbsp;1 is within 1/2
       
  1205      * ulp of the limit value -1, <code>-1.0</code> should be
       
  1206      * returned.
       
  1207      *
       
  1208      * @param   x   the exponent to raise <i>e</i> to in the computation of
       
  1209      *              <i>e</i><sup><code>x</code></sup>&nbsp;-1.
       
  1210      * @return  the value <i>e</i><sup><code>x</code></sup>&nbsp;-&nbsp;1.
       
  1211      */
       
  1212     public static double expm1(double x) {
       
  1213 	return StrictMath.expm1(x);
       
  1214     }
       
  1215 
       
  1216     /**
       
  1217      * Returns the natural logarithm of the sum of the argument and 1.
       
  1218      * Note that for small values <code>x</code>, the result of
       
  1219      * <code>log1p(x)</code> is much closer to the true result of ln(1
       
  1220      * + <code>x</code>) than the floating-point evaluation of
       
  1221      * <code>log(1.0+x)</code>.
       
  1222      *
       
  1223      * <p>Special cases:
       
  1224      *
       
  1225      * <ul>
       
  1226      *
       
  1227      * <li>If the argument is NaN or less than -1, then the result is
       
  1228      * NaN.
       
  1229      *
       
  1230      * <li>If the argument is positive infinity, then the result is
       
  1231      * positive infinity.
       
  1232      *
       
  1233      * <li>If the argument is negative one, then the result is
       
  1234      * negative infinity.
       
  1235      *
       
  1236      * <li>If the argument is zero, then the result is a zero with the
       
  1237      * same sign as the argument.
       
  1238      *
       
  1239      * </ul>
       
  1240      *
       
  1241      * <p>The computed result must be within 1 ulp of the exact result.
       
  1242      * Results must be semi-monotonic.
       
  1243      *
       
  1244      * @param   x   a value
       
  1245      * @return the value ln(<code>x</code>&nbsp;+&nbsp;1), the natural
       
  1246      * log of <code>x</code>&nbsp;+&nbsp;1
       
  1247      */
       
  1248     public static double log1p(double x) {
       
  1249 	return StrictMath.log1p(x);
       
  1250     }
       
  1251 }
       
  1252 '
       
  1253 !
    33 !
  1254 
    34 
  1255 javaSourcesBig
    35 javaSourcesBig
  1256 	^ self workingJavaInDirectory: '../java-src/java/util'
    36 	^ self javaInDirectory: '../java-src/java/util'.
       
    37 	"^ self workingJavaInDirectory: '../java-src/java/util'"
  1257 !
    38 !
  1258 
    39 
  1259 petitParserPackage
    40 petitParserPackage
  1260 ^ '
    41 ^ '
  1261 Object subclass: #PPCharSetPredicate
    42 Object subclass: #PPCharSetPredicate
  5173 isPetitFailure
  3954 isPetitFailure
  5174 	^ false!! !!
  3955 	^ false!! !!
  5175 '
  3956 '
  5176 !
  3957 !
  5177 
  3958 
       
  3959 smalltalkInDirectory: directory
       
  3960 	| files |
       
  3961 	files := self readDirectory: directory.
       
  3962 	files := self files: files withExtension: 'st'.
       
  3963 	
       
  3964 	^ files collect: [ :f | (FileStream fileNamed: f) contents ]
       
  3965 !
       
  3966 
  5178 smalltalkObjectMethods
  3967 smalltalkObjectMethods
  5179 	^ Object allMethods collect: [ :m | m sourceCode ].
  3968 	^ Object allMethods collect: [ :m | m sourceCode ].
  5180 !
  3969 !
  5181 
  3970 
  5182 smalltalkSourcesBig
  3971 smalltalkSourcesBig
       
  3972 	^ self smalltalkInDirectory: '../smalltalk-src/'
       
  3973 !
       
  3974 
       
  3975 smalltalkSourcesBig_old
  5183 	^ ((Smalltalk allClasses copyFrom: 1 to: 30) collect: [ :c |
  3976 	^ ((Smalltalk allClasses copyFrom: 1 to: 30) collect: [ :c |
  5184 			c allMethods collect: [ :m | m sourceCode ]
  3977 			c allMethods collect: [ :m | m sourceCode ]
  5185 	  ]) gather: [:each | each ].
  3978 	  ]) gather: [:each | each ].
  5186 !
  3979 !
  5187 
  3980