Java Float Number Divide divide(final float dividend, final float divisor)

Here you can find the source of divide(final float dividend, final float divisor)

Description

Division that is tolerant of NaN.

License

BSD License

Parameter

Parameter Description
dividend Dividend
divisor Divisor

Return

A value

Declaration

public static float divide(final float dividend, final float divisor) 

Method Source Code

//package com.java2s;
/*L//from  w w  w.j a  v  a  2s.c  o m
 *  Copyright RTI International
 *
 *  Distributed under the OSI-approved BSD 3-Clause License.
 *  See http://ncip.github.com/webgenome/LICENSE.txt for details.
 */

public class Main {
    /**
     * Division that is tolerant of NaN.  NaN / x = NaN and x / NaN = NaN.
     * @param dividend Dividend
     * @param divisor Divisor
     * @return A value
     */
    public static float divide(final float dividend, final float divisor) {
        float value = Float.NaN;
        if (!Float.isNaN(dividend) && !Float.isNaN(divisor)) {
            value = dividend / divisor;
        }
        return value;
    }
}

Related

  1. div(final float a, final float b)
  2. div(float f1, float f2)
  3. Divide_S(float quotient, float divisor)
  4. Divide_SL(final float quotient, final float divisor)