Java Float Number Mod fmod(double a, double b)

Here you can find the source of fmod(double a, double b)

Description

Computes the floating-point remainder of a/b.

License

Open Source License

Parameter

Parameter Description
a Variable a
b Variable b

Return

the result

Declaration

public static double fmod(double a, double b) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*from  ww w .  j  a v  a  2 s .c  o m*/
     * Computes the floating-point remainder of a/b.
     * @param a Variable a  
     * @param b Variable b
     * @return the result
     */
    public static double fmod(double a, double b) {
        int result = (int) Math.floor(a / b);
        return a - result * b;
    }
}

Related

  1. fmod(double a, double b)
  2. FMod(double x, double y)
  3. fmodf(Float float1, float float2)
  4. fmodulo(double v1, double v2)