Java Double Number Clip clip2(double n, double d, double[] t)

Here you can find the source of clip2(double n, double d, double[] t)

Description

clip

License

Open Source License

Declaration

private static boolean clip2(double n, double d, double[] t) 

Method Source Code

//package com.java2s;
/*//from   w ww .j  av  a2 s. c  o  m
 * Copyright (c) 2012 Diamond Light Source Ltd.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 */

public class Main {
    private static boolean clip2(double n, double d, double[] t) {
        if (d == 0) {
            return n <= 0;
        }

        double v = n / d;
        if (d > 0) {
            if (v > t[1])
                return false;
        } else {
            if (v < t[1])
                t[1] = v;
        }

        return true;
    }
}

Related

  1. clip(double value, double min, double max)
  2. clip(double value, double min, double max)
  3. clip(double[] values, double min, double max)
  4. clip(final double n, final double minValue, final double maxValue)
  5. clip(final double value, final double min, final double max)
  6. clipDecimals(double num, int n)
  7. clipDouble(double value, double max)
  8. clipnorm(double d, double min, double max)
  9. clipNormalized(double a)