39 public static int sign(
final int x) {
40 return (0 < x ? 1 : 0) - (x < 0 ? 1 : 0);
46 public static int sign(
final long x) {
47 return (0 < x ? 1 : 0) - (x < 0 ? 1 : 0);
52 public static short sign(
final short x) {
53 return (
short) ( (0 < x ? 1 : 0) - (x < 0 ? 1 : 0) );
80 return Integer.MIN_VALUE == x ? Integer.MAX_VALUE : -x;
87 return Long.MIN_VALUE == x ? Long.MAX_VALUE : -x;
93 return Short.MIN_VALUE == x ? Short.MAX_VALUE : (short)-x;
105 public static int abs(
final int x) {
112 public static long abs(
final long x) {
118 public static short abs(
final short x) {
139 public static int digits10(
final int x,
final int x_sign,
final boolean sign_is_digit) {
145 return 1 + (int)( Math.log10(
invert_sign( x ) ) ) + ( sign_is_digit ? 1 : 0 );
147 return 1 + (int)( Math.log10( x ) );
154 public static int digits10(
final long x,
final int x_sign,
final boolean sign_is_digit) {
160 return 1 + (int)( Math.log10(
invert_sign( x ) ) ) + ( sign_is_digit ? 1 : 0 );
162 return 1 + (int)( Math.log10( x ) );
180 public static int digits10(
final int x,
final boolean sign_is_digit) {
187 public static int digits10(
final long x,
final boolean sign_is_digit) {
static int digits10(final long x, final int x_sign, final boolean sign_is_digit)
See digits10(int, int, boolean)
static int sign(final int x)
Returns the value of the sign function.
static long abs(final long x)
See abs(int).
static int invert_sign(final int x)
Safely inverts the sign of an integral number.
static int digits10(final int x, final int x_sign, final boolean sign_is_digit)
Returns the number of decimal digits of the given integral value number using std::log10<T>().
static short abs(final short x)
See abs(int).
static int digits10(final long x, final boolean sign_is_digit)
See digits10(int, boolean)
static long invert_sign(final long x)
See invert_sign(int).
static int sign(final long x)
See sign(int).
static int digits10(final int x, final boolean sign_is_digit)
Returns the number of decimal digits of the given integral value number using std::log10<T>().
static int abs(final int x)
Returns the absolute value of an integral number.
static short sign(final short x)
See sign(int).
static short invert_sign(final short x)
See invert_sign(int).