src/java.base/share/classes/java/lang/Math.java
changeset 54750 1851a532ddfe
parent 54492 9d0ae9508d53
child 57863 cf45b7945e4b
child 58678 9cf78a70fa4f
equal deleted inserted replaced
54749:98558b7544c7 54750:1851a532ddfe
  1351      * negative.
  1351      * negative.
  1352      *
  1352      *
  1353      * @param   a   the argument whose absolute value is to be determined
  1353      * @param   a   the argument whose absolute value is to be determined
  1354      * @return  the absolute value of the argument.
  1354      * @return  the absolute value of the argument.
  1355      */
  1355      */
       
  1356     @HotSpotIntrinsicCandidate
  1356     public static int abs(int a) {
  1357     public static int abs(int a) {
  1357         return (a < 0) ? -a : a;
  1358         return (a < 0) ? -a : a;
  1358     }
  1359     }
  1359 
  1360 
  1360     /**
  1361     /**
  1368      * is negative.
  1369      * is negative.
  1369      *
  1370      *
  1370      * @param   a   the argument whose absolute value is to be determined
  1371      * @param   a   the argument whose absolute value is to be determined
  1371      * @return  the absolute value of the argument.
  1372      * @return  the absolute value of the argument.
  1372      */
  1373      */
       
  1374     @HotSpotIntrinsicCandidate
  1373     public static long abs(long a) {
  1375     public static long abs(long a) {
  1374         return (a < 0) ? -a : a;
  1376         return (a < 0) ? -a : a;
  1375     }
  1377     }
  1376 
  1378 
  1377     /**
  1379     /**
  1392      * {@code Float.intBitsToFloat(0x7fffffff & Float.floatToRawIntBits(a))}
  1394      * {@code Float.intBitsToFloat(0x7fffffff & Float.floatToRawIntBits(a))}
  1393      *
  1395      *
  1394      * @param   a   the argument whose absolute value is to be determined
  1396      * @param   a   the argument whose absolute value is to be determined
  1395      * @return  the absolute value of the argument.
  1397      * @return  the absolute value of the argument.
  1396      */
  1398      */
       
  1399     @HotSpotIntrinsicCandidate
  1397     public static float abs(float a) {
  1400     public static float abs(float a) {
  1398         return (a <= 0.0F) ? 0.0F - a : a;
  1401         return (a <= 0.0F) ? 0.0F - a : a;
  1399     }
  1402     }
  1400 
  1403 
  1401     /**
  1404     /**