175584Sru/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
275584Sru     Written by James Clark (jjc@jclark.com)
375584Sru
475584SruThis file is part of groff.
575584Sru
675584Srugroff is free software; you can redistribute it and/or modify it under
775584Sruthe terms of the GNU General Public License as published by the Free
875584SruSoftware Foundation; either version 2, or (at your option) any later
975584Sruversion.
1075584Sru
1175584Srugroff is distributed in the hope that it will be useful, but WITHOUT ANY
1275584SruWARRANTY; without even the implied warranty of MERCHANTABILITY or
1375584SruFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1475584Srufor more details.
1575584Sru
1675584SruYou should have received a copy of the GNU General Public License along
1775584Sruwith groff; see the file COPYING.  If not, write to the Free Software
18151497SruFoundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */
1975584Sru
2075584Sru#include <math.h>
2175584Sru
2275584Srudouble fmod(x, y)
2375584Sru     double x, y;
2475584Sru{
2575584Sru  double quot = x/y;
2675584Sru  return x - (quot < 0.0 ? ceil(quot) : floor(quot)) * y;
2775584Sru}
2875584Sru
29