private double getMax(double[] fftd, int lowerCutoffHz, int upperCutoffHz) { double max = Double.MIN_VALUE; for (int i = lowerCutoffHz; i <= upperCutoffHz; i++) { max = MathLib.max(max, fftd[i]); } return max; }
private int getSubMapDepth() { if (_useSubMaps) { int depth = 0; for (int i = 0; i < C2; i++) { int subMapDepth = _subMaps[i].getSubMapDepth(); depth = MathLib.max(depth, subMapDepth); } return depth + 1; } else { return 0; } }
private int getMaximumDistance() { int max = 0; if (_useSubMaps) { for (int i = 0; i < C2; i++) { int subMapMax = _subMaps[i].getMaximumDistance(); max = MathLib.max(max, subMapMax); } return max; } for (int i = 0; i < _entries.length; i++) { Entry entry = _entries[i]; if ((entry != null) && (entry != Entry.NULL)) { int slot = (entry._keyHash >> _keyShift) & (_entries.length - 1); int distanceToSlot = i - slot; if (distanceToSlot < 0) { distanceToSlot += _entries.length; } if (distanceToSlot > max) { max = distanceToSlot; } } } return max; }
private int getDepth() { if (_data != null) // Primitive. return 0; return MathLib.max(_head.getDepth(), _tail.getDepth()) + 1; } private int getNbrOfBranches() {
/** * Set the {@link LocalContext local} concurrency. Concurrency is * hard limited by {@link #MAXIMUM_CONCURRENCY}. * * @param concurrency the new concurrency (<code>0</code> or negative * number to disable concurrency). */ public static void setConcurrency(int concurrency) { concurrency = MathLib.max(0, concurrency); concurrency = MathLib.min(((Integer) MAXIMUM_CONCURRENCY.get()).intValue(), concurrency); CONCURRENCY.set(new Integer(concurrency)); }
private int getDepth() { if (_data != null) // Primitive. return 0; return MathLib.max(_head.getDepth(), _tail.getDepth()) + 1; }
/** * Returns the index within this text of the first occurrence of the * specified character, starting the search at the specified index. * * @param c the character to search for. * @param fromIndex the index to start the search from. * @return the index of the first occurrence of the character in this text * that is greater than or equal to <code>fromIndex</code>, * or <code>-1</code> if the character does not occur. */ public int indexOf(char c, int fromIndex) { if (_data != null) { // Primitive. for (int i = MathLib.max(fromIndex, 0); i < _count; i++) { if (_data[i] == c) return i; } return -1; } else { // Composite. final int cesure = _head._count; if (fromIndex < cesure) { final int headIndex = _head.indexOf(c, fromIndex); if (headIndex >= 0) return headIndex; // Found in head. } final int tailIndex = _tail.indexOf(c, fromIndex - cesure); return (tailIndex >= 0) ? tailIndex + cesure : -1; } }
/** * Returns the index within this text of the first occurrence of the * specified character, starting the search at the specified index. * * @param c the character to search for. * @param fromIndex the index to start the search from. * @return the index of the first occurrence of the character in this text * that is greater than or equal to <code>fromIndex</code>, * or <code>-1</code> if the character does not occur. */ public int indexOf(char c, int fromIndex) { if (_data != null) { // Primitive. for (int i = MathLib.max(fromIndex, 0); i < _count; i++) { if (_data[i] == c) return i; } return -1; } else { // Composite. final int cesure = _head._count; if (fromIndex < cesure) { final int headIndex = _head.indexOf(c, fromIndex); if (headIndex >= 0) return headIndex; // Found in head. } final int tailIndex = _tail.indexOf(c, fromIndex - cesure); return (tailIndex >= 0) ? tailIndex + cesure : -1; } }
final int thisSize = this._size; final int thatSize = that._size; Term result = FACTORY.array(MathLib.max(thisSize, thatSize)); result._size = 0; for (int i = 0, j = 0;;) {
min = MathLib.min(_minimum * that._maximum, _maximum max = MathLib.max(_minimum * that._minimum, _maximum
int log10Error = (int) MathLib.floor(MathLib.log10(error)); int digits = log10Value - log10Error - 1; // Exact digits. digits = MathLib.max(1, digits + _errorDigits);
int log10Error = (int) MathLib.floor(MathLib.log10(error)); int digits = log10Value - log10Error - 1; // Exact digits. digits = MathLib.max(1, digits + _errorDigits);
/** * Returns the reciprocal (or inverse) of this real number. * * @return <code>1 / this</code>. */ public Real inverse() { if ((this == NaN) || (this == ZERO)) return NaN; if (this.isExact()) return this.toInexact().inverse(); LargeInteger thisMin = this._significand.minus(this._error); LargeInteger thisMax = this._significand.plus(this._error); if (thisMin.isNegative() && thisMax.isPositive()) // Encompasses 0 return NaN; int digits = MathLib.max(thisMin.digitLength(), thisMax.digitLength()); long exp = ((long) -this._exponent) - digits - digits; if ((exp > Integer.MAX_VALUE || (exp < Integer.MIN_VALUE))) return NaN; // Exponent overflow. LargeInteger min = div(2 * digits, thisMax); LargeInteger max = div(2 * digits, thisMin); Real real = FACTORY.object(); real._exponent = (int) exp; real._significand = min.plus(max).shiftRight(1); real._error = max.minus(min).plus(LargeInteger.ONE); return real.normalize(); }