161f28255Scgd.\" Copyright (c) 1991 The Regents of the University of California. 261f28255Scgd.\" All rights reserved. 361f28255Scgd.\" 461f28255Scgd.\" Redistribution and use in source and binary forms, with or without 561f28255Scgd.\" modification, are permitted provided that the following conditions 661f28255Scgd.\" are met: 761f28255Scgd.\" 1. Redistributions of source code must retain the above copyright 861f28255Scgd.\" notice, this list of conditions and the following disclaimer. 961f28255Scgd.\" 2. Redistributions in binary form must reproduce the above copyright 1061f28255Scgd.\" notice, this list of conditions and the following disclaimer in the 1161f28255Scgd.\" documentation and/or other materials provided with the distribution. 12eb7c1594Sagc.\" 3. Neither the name of the University nor the names of its contributors 1361f28255Scgd.\" may be used to endorse or promote products derived from this software 1461f28255Scgd.\" without specific prior written permission. 1561f28255Scgd.\" 1661f28255Scgd.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 1761f28255Scgd.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1861f28255Scgd.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1961f28255Scgd.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2061f28255Scgd.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2161f28255Scgd.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2261f28255Scgd.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2361f28255Scgd.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2461f28255Scgd.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2561f28255Scgd.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2661f28255Scgd.\" SUCH DAMAGE. 2761f28255Scgd.\" 28dfb9caabSmycroft.\" from: @(#)fmod.3 5.1 (Berkeley) 5/2/91 29*8c61176cSjoerg.\" $NetBSD: fmod.3,v 1.12 2013/11/12 16:48:39 joerg Exp $ 3061f28255Scgd.\" 31*8c61176cSjoerg.Dd November 12, 2013 3261f28255Scgd.Dt FMOD 3 3361f28255Scgd.Os 3461f28255Scgd.Sh NAME 35f8173630Skleink.Nm fmod , 36*8c61176cSjoerg.Nm fmodf , 37*8c61176cSjoerg.Nm fmodl 3861f28255Scgd.Nd floating-point remainder function 39312aca53Sperry.Sh LIBRARY 40312aca53Sperry.Lb libm 4161f28255Scgd.Sh SYNOPSIS 42472351e1Swiz.In math.h 4361f28255Scgd.Ft double 4461f28255Scgd.Fn fmod "double x" "double y" 45df8b005fSjtc.Ft float 46df8b005fSjtc.Fn fmodf "float x" "float y" 47*8c61176cSjoerg.Ft long double 48*8c61176cSjoerg.Fn fmodl "long double x" "long double y" 4961f28255Scgd.Sh DESCRIPTION 5061f28255ScgdThe 5161f28255Scgd.Fn fmod 5261f28255Scgdfunction computes the floating-point remainder of 5361f28255Scgd.Fa x Ns / Fa y . 5461f28255Scgd.Sh RETURN VALUES 5561f28255ScgdThe 56*8c61176cSjoerg.Fn fmod , 57*8c61176cSjoerg.Fn fmodf , 58df8b005fSjtcand 59*8c61176cSjoerg.Fn fmodl 60df8b005fSjtcfunctions return the value 6161f28255Scgd.Sm off 6261f28255Scgd.Fa x - Em i * Fa y , 6361f28255Scgd.Sm on 6461f28255Scgdfor some integer 6561f28255Scgd.Em i 6661f28255Scgdsuch that, if 6761f28255Scgd.Fa y 6861f28255Scgdis non-zero, the result has the same sign as 6961f28255Scgd.Fa x 7061f28255Scgdand magnitude less than the magnitude of 7161f28255Scgd.Fa y . 7261f28255ScgdIf 7361f28255Scgd.Fa y 7461f28255Scgdis zero, whether a domain error occurs or the 7561f28255Scgd.Fn fmod 7661f28255Scgdfunction returns zero is implementation-defined. 7761f28255Scgd.Sh SEE ALSO 7861f28255Scgd.Xr math 3 7961f28255Scgd.Sh STANDARDS 8061f28255ScgdThe 8161f28255Scgd.Fn fmod 8261f28255Scgdfunction conforms to 8361f28255Scgd.St -ansiC . 84