xref: /freebsd/lib/msun/man/fmod.3 (revision e0c4386e7e71d93b0edc0c8fa156263fc4a8b0b6)
1.\" Copyright (c) 1991 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. Neither the name of the University nor the names of its contributors
13.\"    may be used to endorse or promote products derived from this software
14.\"    without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.Dd April 3, 2022
29.Dt FMOD 3
30.Os
31.Sh NAME
32.Nm fmod ,
33.Nm fmodf ,
34.Nm fmodl
35.Nd floating-point remainder functions
36.Sh LIBRARY
37.Lb libm
38.Sh SYNOPSIS
39.In math.h
40.Ft double
41.Fn fmod "double x" "double y"
42.Ft float
43.Fn fmodf "float x" "float y"
44.Ft long double
45.Fn fmodl "long double x" "long double y"
46.Sh DESCRIPTION
47The
48.Fn fmod ,
49.Fn fmodf ,
50and
51.Fn fmodl
52functions compute the floating-point remainder of
53.Fa x Ns / Fa y .
54.Sh RETURN VALUES
55If
56.Fa y
57is non-zero, the
58.Fn fmod ,
59.Fn fmodf ,
60and
61.Fn fmodl
62functions return the value
63.Sm off
64.Fa x - Em i * Fa y ,
65.Sm on
66for some integer
67.Em i ,
68such that the result has the same sign as
69.Fa x
70and magnitude less than the magnitude of
71.Fa y .
72If
73.Fa y
74is zero, a \*(Na is produced.
75.Sh SEE ALSO
76.Xr math 3
77.Sh STANDARDS
78The
79.Fn fmod ,
80.Fn fmodf ,
81and
82.Fn fmodl
83functions conform to
84.St -isoC-99 .
85.Sh HISTORY
86An
87.Fn fmod
88function first appeared in
89.At v5 .
90