public class Util extends Object
Modifier and Type  Method and Description 

static long 
ifFinite(long x,
long y)
Returns the argument
y limited to Apfloat.INFINITE . 
static int 
log2down(int x)
Base2 logarithm rounded down to nearest power of two.

static int 
log2down(long x)
Base2 logarithm rounded down to nearest power of two.

static int 
log2up(int x)
Base2 logarithm rounded up to nearest power of two.

static int 
log2up(long x)
Base2 logarithm rounded up to nearest power of two.

static int 
round23down(int x)
Round down to nearest power of two or three times a power of two.

static long 
round23down(long x)
Round down to nearest power of two or three times a power of two.

static int 
round23up(int x)
Round up to nearest power of two or three times a power of two.

static long 
round23up(long x)
Round up to nearest power of two or three times a power of two.

static int 
round2down(int x)
Round down to nearest power of two.

static long 
round2down(long x)
Round down to nearest power of two.

static int 
round2up(int x)
Round up to nearest power of two.

static long 
round2up(long x)
Round up to nearest power of two.

static int 
sqrt4down(int x)
Square root rounded down to nearest power of two.

static long 
sqrt4down(long x)
Square root rounded down to nearest power of two.

static int 
sqrt4up(int x)
Square root rounded up to nearest power of two.

static long 
sqrt4up(long x)
Square root rounded up to nearest power of two.

public static int round2down(int x)
x
 The input value, which must be nonnegative.x
rounded down to the nearest power of two.public static long round2down(long x)
x
 The input value, which must be nonnegative.x
rounded down to the nearest power of two.public static int round2up(int x)
x
 The input value, which must be nonnegative and not greater than 2^{30}.x
rounded up to the nearest power of two.public static long round2up(long x)
x
 The input value, which must be nonnegative and not greater than 2^{62}.x
rounded up to the nearest power of two.public static int round23down(int x)
x
 The input value, which must be nonnegative.x
rounded down to nearest power of two or three times a power of two.public static long round23down(long x)
x
 The input value, which must be nonnegative.x
rounded down to nearest power of two or three times a power of two.public static int round23up(int x)
x
 The input value, which must be nonnegative and not greater than 3 * 2^{29}.x
rounded up to the nearest power of two or three times a power of two.public static long round23up(long x)
x
 The input value, which must be nonnegative and not greater than 3 * 2^{61}.x
rounded up to the nearest power of two or three times a power of two.public static int sqrt4down(int x)
x
 The input value, which must be nonnegative.x
rounded down to nearest power of two.public static long sqrt4down(long x)
x
 The input value, which must be nonnegative.x
rounded down to nearest power of two.public static int sqrt4up(int x)
x
 The input value, which must be nonnegative.x
rounded up to nearest power of two.public static long sqrt4up(long x)
x
 The input value, which must be nonnegative.x
rounded up to nearest power of two.public static int log2down(int x)
x
 The input value, which must be positive.log_{2}(x)
rounded down to nearest integer.public static int log2down(long x)
x
 The input value, which must be positive.log_{2}(x)
rounded down to nearest integer.public static int log2up(int x)
x
 The input value, which must be positive.log_{2}(x)
rounded up to nearest integer.public static int log2up(long x)
x
 The input value, which must be positive.log_{2}(x)
rounded up to nearest integer.public static long ifFinite(long x, long y)
y
limited to Apfloat.INFINITE
.
In case x
is Apfloat.INFINITE
, then Apfloat.INFINITE
is returned, otherwise y
. Also if y
is negative or zero, this is
treated as a case of overflow, and Apfloat.INFINITE
is returned. The
return value is thus always positive.x
 The argument that is tested to be Apfloat.INFINITE
.y
 The argument that is returned if x
is not Apfloat.INFINITE
.(x == Apfloat.INFINITE  y <= 0 ? Apfloat.INFINITE : y)
Copyright © 2017. All rights reserved.