Java Double Number Divide divZ(double z)

Here you can find the source of divZ(double z)

Description

Returns the reciprocal of a number, or zero if undefined.

License

Open Source License

Declaration

public static double divZ(double z) 

Method Source Code

//package com.java2s;
/*/*from   w w w .  ja v a 2 s .  c  o  m*/
 * BioAssay Ontology Annotator Tools
 * 
 * (c) 2014-2016 Collaborative Drug Discovery Inc.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License 2.0
 * as published by the Free Software Foundation:
 * 
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 */

public class Main {
    /**
     * Returns the reciprocal of a number, or zero if undefined.
     */
    public static double divZ(double z) {
        return z == 0 ? 1 : 1 / z;
    }

    /**
     * Returns the reciprocal of a number, or zero if undefined.
     */
    public static float divZ(float z) {
        return z == 0 ? 1 : 1 / z;
    }
}

Related

  1. divideComplex(double realOne, double imagOne, double realTwo, double imagTwo)
  2. divideDouble(double first, double second)
  3. divideDouble(double first, double second, int scale, int roundingMode)
  4. divideInts(int numerator, int denominator)
  5. divideNumber(Object divisor, Object dividend)
  6. getIntDividedCeil(final int nDividend, final int nDivisor)
  7. getLongDivided(final long nDividend, final long nDivisor, @Nonnull final RoundingMode eRoundingMode)
  8. roundDivide(double[] dividend, double[] divisor, int scale)
  9. safeDivide(long dividend, long divisor)