Java Double Number mod Mod(double arg1, double arg2)

Here you can find the source of Mod(double arg1, double arg2)

Description

The FORTRAN mod function

License

Open Source License

Parameter

Parameter Description
arg1 a parameter
arg2 a parameter

Return

returns arg1 mod arg2

Declaration

public static float Mod(double arg1, double arg2) 

Method Source Code

//package com.java2s;
/*//  w w  w . ja v  a  2  s  . c  o m
 * File:  util.java 
 *             
 * Copyright (C) 2004, Ruth Mikkelson
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA.
 *
 * Contact : Ruth Mikkelson <mikkelsonr@uwstout.edu>
 *           Department of Mathematics, Statistics and Computer Science
 *           University of Wisconsin-Stout
 *           Menomonie, WI 54751, USA
 *
 * This work was supported by the Intense Pulsed Neutron Source Division
 * of Argonne National Laboratory, Argonne, IL 60439-4845, USA.
 * This work was supported by the National Science Foundation under
 * grant number DMR-0218882
 *
 * For further information, see <http://www.pns.anl.gov/ISAW/>
 *
 *
 * Modified:
 *
 * $Log$
 * Revision 1.5  2004/10/09 14:05:16  rmikk
 * Added a Write(unitNum, S) in a case where it was omitted
 *
 * Revision 1.4  2004/08/19 12:24:06  rmikk
 * Added Write to file via unit numbers for FORTRAN code.  The new routines
 *    include all the WRITE routines with unit number is added as the
 *    first parameter , WRITEOPEN and WRITECLOSE
 *
 * Revision 1.3  2004/08/02 20:06:02  rmikk
 * The WRITE methods now go to the status pane
 *
 * Revision 1.2  2004/07/30 14:49:46  rmikk
 * Removed unused imports
 *
 * Revision 1.1  2004/06/16 21:02:32  rmikk
 * Initial Checkin in this directory. 
 * Moved from the Command.JavaCC directory
 * Added documentation and GPL
 *
 */

public class Main {
    /**
     * The FORTRAN mod function
     * @param arg1
     * @param arg2
     * @return  returns arg1 mod arg2
     */
    public static float Mod(double arg1, double arg2) {
        if (arg2 == 0)
            return (float) arg1;
        int quo = (int) (arg1 / arg2);
        return (float) (arg1 - arg2 * quo);
    }
}

Related

  1. mod(double a, double b)
  2. mod(double a, double b)
  3. mod(double i, final double n)
  4. mod(double left, double right)
  5. mod(double m, double n)
  6. mod(double n, double d)